Setting the port for node.js server on Heroku
问题 I launched a node.js server with the following line to set the port: app.set('port', process.env.PORT || 8080); This means that, it should either read the PORT env variable or default to 8080, as it does when it's run locally. Neither of them is happening on Heroku, and the server always uses the default port 80. Any idea how to change it? heroku config PORT: 8080 回答1: You can't. Heroku sets the PORT variable that you are supposed to bind, and listens on tcp/80. 回答2: You should use the port