来自 http://blog.csdn.net/medivhq/article/details/74171939
我按照菜鸟教程上的写法为:(http://www.runoob.com/nodejs/nodejs-express-framework.html)
var server = app.listen(8081,function () { var host = server.address().address var port = server.address().port console.log("应用实例,访问地址为 http://%s:%s", host, port)})
打印结果:
应用实例,访问地址为 修改方法,自定义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)})