Deploy your Nodejs Project to Heroku

Deploy your Nodejs Project to Heroku

image.png

This post is useful for beginners that want to deploying free a nodejs project.

Some previus knowledge that helps you:

  • git and github.

Must have:

  • heroku account create.

  • create new project(create new app) in heroku dashboard.

image.png

Install heroku CLI. Is a npm package u must install it global

npm i -g heroku

Login to your heroku account with your credentials.

heroku login

Your project must be a git version control init.

git init
git add README.md
git commit -m "first commit"
git branch -M main

Method 1 :

Get remote url app from heroku app (if you create from heroku dashboar site).

heroku git:remote -a my-project-name

image.png

Method 2 :

**create heroku app from CLI **

heroku apps:create my-other-project-name

Push changes and deploy it

git push heroku main

You can check a list of your heroku apps with

 heroku apps

U have .env variables?. examples

heroku config:set TOKEN=VALUE
heroku config:set OTHER_SECRET_TOKEN=VALUE

Details.

devcenter.heroku.com/articles/heroku-cli

devcenter.heroku.com/articles/heroku-cli-co..

update free version is not free anymore