OneCompiler

Updating an existing NodeJS project to run on Heroku

250

Following are the two changes we need to make to an existing NodeJS project to make it deployable in Heroku environment

1. Add NodeJS engine in package.json

Add the following to your package.json

"engines": {
    "node": "12.14.1"
},

2. Add Procfile at the root of the project

Add a new file with name Procfile at the root of the project with the following content

web: node index.js

Note: Assuming the file to start your project is index.js else keep the appropriate name