DEV Community

Cover image for Deploying an existing  Node.js app  to Heroku
SenaitEkubai
SenaitEkubai

Posted on

Deploying an existing Node.js app to Heroku

Before you start, create a free Heroku account, install Node.js and npm locally. Link your app to GitHub. It needs to be on github for it to be deployed.

Set up heroku

Download and run the installer for your platform from the heroku web page and follow the instructions there.

Then run the following commands

heroku create
git remote -v
Add a procfile and add this code inside web: node app.js
Listen on the correct port so add this line of code
const PORT = process.env.PORT || 3000;
app.listen(PORT);

to open the app Heroku open

Top comments (0)