1.Express模块server.address().address为::
原始写法:
var server = app.listen(8081,function () {
var host = server.address().address
var port = server.address().port
console.log("应用实例,访问地址为 http://%s:%s", host, port)
})
打印结果:
应用实例,访问地址为 http://:::8081
修改方法,自定义locahost即可:
var server = app.listen(8081,'localhost',function () {
var host = server.address().address
var port = server.address().port
console.log("应用实例,访问地址为 http://%s:%s", host, port)
})
打印结果如下:
应用实例,访问地址为 http://127.0.0.1:8081