nodejs 生产环境配置

1.node 默认为development(开发)模式

启动node 时可以设置模式为生产模式

set NODE_ENV=production
node app.js

2.设置node监听的端口
var port = normalizePort(process.env.PORT || '5000');//程序中这样设置,默认为5000端口

当命令台启动程序时如下设置,则端口配置为1234.

set PORT=1234

node app.js
 
原文地址:https://www.cnblogs.com/ytu2010dt/p/5450831.html