按照github上的quick start一步一步下来,npm start 启动server, 但app.js貌似没有监听任何端口,但是server启动了?通过浏览器访问不了页面,是这样吗?
究竟是哪里有问题?
创建方法就是:
$ express /tmp/foo && cd /tmp/foo
启动服务器是:
$ npm install
$ npm start
更:
正如一楼说的,默认的是3000端口,写在bin/www里,但问题是这里明明debug出了文本,为什么终端窗口里看不到?
var server = app.listen(app.get('port'), function() {
debug('Express server listening on port ' + server.address().port);
});
怪我咯2017-04-17 11:24:18
The listening port of express is set in the /bin/www.js file, and the default is port 3000. Do you have a port added to your browser?
黄舟2017-04-17 11:24:18
Looking at the project generated by express, /bin/www
required the https://github.com/visionmedia/debug module.
The DEBUG environment variable is then used to enable these based on space or comma-delimited names.
You can see all debug information like this:
DEBUG=* npm start
Of course there is also the sentence you expect to see: Express server listening on port 3000