Deploy node project to the Heroku

Steps to deploy and Host your node project in Heroku.

Step: 1 Create Heroku account or log in.

Goto this link to Heroku login https://id.heroku.com/login and after login create a new app as shown below.
Create new Heroku app



Here we add our project name and hosting region.

Enter your project name and check availability


Here we are in our Heroku app dashboard, so for deploying our source code or project in Heroku app we goto Deploy Tab



Select Deployment method for our project
 Here I am using Heroku CLI. Before you deploy you need to follow these Steps: 2 and 3 completely.

Important Note: If you have already installed Git and Heroku CLI on your computer then skip Steps: 2 and 3. 

Goto project directory and open Terminal or Command Prompt to login Heroku Account after that run below command in your Terminal or command prompt.
heroku login
Example:- F:\sam-node-project> heroku login
Run above command in Terminal or Command Prompt to log in Heroku Account from your project directory 



Adding local project to Heroku Git
If you don't have git repository project then run below command in Terminal or Command prompt to initialize a git repository.
Examples:- 
F:\sam-node-project>git init
F:\sam-node-project>heroku git:remote -a sam-node-project



If you have existing git repository project then run below command in Terminal or Command prompt.
Example:
F:\sam-node-project>heroku git:remote -a sam-node-project
Finally, we are ready to host or deploy our node project into Heroku Server


If our code successfully pushed to the Heroku Git, then we see the URL of our live project.
Now we are successfully deployed our node project to Heroku Server.


Step: 2 Install Git on your local machine

Visit the official website to download latest Git installer
 Git Installer

Step: 3 Install Heroku CLI on your local machine

Visit the official documentation to set up the Heroku CLI in your computer
Download and Install Heroku CLI


Note: If you face any issue, please comment, I will try to help you or fix as soon as possible.

Comments