Skip to content

Instantly share code, notes, and snippets.

@mahendra0859
Created April 19, 2020 19:20
Show Gist options
  • Save mahendra0859/4da5fc5bcf71364acd5fc937197aaaac to your computer and use it in GitHub Desktop.
Save mahendra0859/4da5fc5bcf71364acd5fc937197aaaac to your computer and use it in GitHub Desktop.
Deploying NodeJS app in Heroku

Deploying NodeJS app in Heroku

  • Create a new app in heroku dashboard

  • Download and install the Heroku CLI

$ heroku login
$ cd my-project/
$ git init
$ heroku git:remote -a my-application-name
$ git add .
$ git commit -am "Fisrt commit"
$ git push heroku master
$ echo "web: node index.js" >> Procfile
  • Modify the script element package.json file
"scripts": {
    "start": "node index.js"
  },
  • Commit the new changes
$ git commit -am "Second commit"
$ git push heroku master
  • check overview tab to check the build status and deployed status in heroku dashboard

  • Chaeck the setting tab and domain section for the end point

  • use the follwing command to check the logs

$ heroku logs --tail
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment