February 6

Heroku Tutorial For Beginners – Deploy Your App to Heroku Under 5 Minutes!



If you don’t know already Heroku is a cloud platform as a service supporting several programming languages. You can deploy projects written in many kinds of languages in there. They support NodeJS, Ruby, Java, Php, Python and other languages and the best part is that they have a free plan.

So, now let’s go to heroku.com and click on the sign up for the free button there.

Create an account there and confirm your email address. After that create a password and log into the dashboard…

Now you would want to create a new application.  Click on the new button here and give your application a name

You must give your app a unique name so let’s think of something. Ok, now click on “Create App”.

Now what you would want to do is install the Heroku CLI. <– Click on the link here and download the installer.

Start the installer and follow the steps. Now one thing that I came across when I was installing the CLI was that the path variable was not added. So if you come across this you will need to add the path variable manually.

  1. To do so go to search “path” in your windows search and click on Environment Variables:
  2. Now find your path variable and click on it and then click on edit:
  3. Add a new line and type:
    C:\Program Files\heroku\bin

adding path variable

Now to check if your Heroku CLI was properly installed open a command prompt and type Heroku. If everything was fine you should see this in your terminal. If not make sure you added your path correctly. So now go to your NodeJS project open the terminal there and type:

heroku login

Enter your username and password and log in through the command line interface

Now in order to deploy our app to Heroku, we need to create a git repository. If you haven’t installed Git on your pc please make sure you have it. If you don’t go to https://git-scm.com/downloads and download and install it

After that go back to the terminal and type the following

git init

This will initiate a git repository in our project. After that, we need to type the following

(type the name of your project instead of heroku-tutorial)

heroku git:remote -a “heroku-tutorial”

This Heroku as your remote git repository. After that, we need to add all of our files in the git.

However, before you do this make sure you have added your node_modules folder inside your gitignore file. We don’t want to upload them in our git.

After you do this type:

git add .

Now let’s create a commit and publish it. Type the following:

git commit -am "initial commit"

Now the only thing that is left to do is to push our project to Heroku by typing:

git push heroku master

Now after everything is published you can open your DApp by typing:

heroku open

Now here I have published my decentralized application to the web. If you are interested in how to create DApps and smart contracts with solidity. I have created a whole course about this on Udemy.

If you are interested there will be a link in the description to the course with a discount coupon there.


You may also like

JavaScript Multidimensional Array

Node.js Tutorial for Beginners in Visual Studio Code

{"email":"Email address invalid","url":"Website address invalid","required":"Required field missing"}