During development, you set a port that Node listens to.


That doesn’t work with Heroku because Heroku binds your port and you cannot set it yourself.
You’ll get an error: Web process failed to bind to $PORT within 60 seconds of launch.

Fix this with environment variable process.env.PORT:

const PORT = process.env.PORT || 5000;

Further Reading