在 Amazon EC2 上运行。代码是由 express-generator 自动创建的。
要启动应用程序,我必须这样做:
sudo PORT=80 npm 开始
然后我添加了第 14 行:
app.set('port', process.env.PORT || 80);
和 66
http.createServer(app).listen(app.get('port'), function(){
console.log('Express server listening on port ' + app.get('port'));
现在我可以通过说来启动应用程序:
须藤 npm 开始
但它说 - Express 服务器正在侦听端口 3000。我可以从浏览器访问它,但为什么是 3000
包.json
{
"name": "haha",
"version": "0.0.0",
"private": true,
"scripts": {
"start": "node ./bin/www"
},
"dependencies": {
"body-parser": "~1.13.2",
"cookie-parser": "~1.3.5",
"debug": "~2.2.0",
"express": "~4.13.1",
"express-generator": "^4.13.1",
"jade": "~1.11.0",
"kerberos": "file:kerberos",
"mongodb": "^2.0.52",
"morgan": "~1.6.1",
"serve-favicon": "~2.3.0"
}
}