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
Heroku expects a web application to bind its HTTP server to the port defined by the $PORT environment variable. Many frameworks default to port 8080, but can be configured to use an environment variable instead.
The default port for HTTP is 80 – Generally, most web browsers listen to the default port. Below is the code implementation for creating a server in node and making it listen to port 80.
You can't. Heroku sets the PORT variable that you are supposed to bind, and listens on tcp/80.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With