1. const port = process.env.PORT || 9001;
本地开发用9001端口
2. package.json中配置几个启动命令
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "node app.js", //运行npm run start 相当于 node app.js
"server": "nodemon app.js" //运行npm run server 相当于nodemon app.js
},