How to Deploy an Existing Express.js Project to Heroku

Tadashi Shigeoka ·  Sat, November 9, 2019

I’ll introduce how to deploy an existing Express.js project to Heroku.

Heroku

Prerequisites: Express.js Almost Default

express --view=pug expressjs-sandbox

After running this command and making several commits, I’ll create a Heroku app and deploy the existing Express.js app.

📁codenote-net/expressjs-sandbox: My Express.js sandbox

Heroku App Creation ~ Deploy

Add Procfile

Add a Procfile with the following content:

web: npm start

Here’s the git commit:

📁Add Procfile for Heroku · Pull Request #6 · codenote-net/expressjs-sandbox

heroku create app & deploy

Finally, create a Heroku app and git push to complete the deployment.

heroku create expressjs-sandbox

git push heroku master

heroku open # Open https://expressjs-sandbox.herokuapp.com/

You can check the result at https://expressjs-sandbox.herokuapp.com/.

That’s all from the Gemba.

Reference Information