If you are a nodies like roadies then you are on right place. Today i am going to show you that how can we publish our nodejs application on web absolutely free. There is lot’s of free cloud server available on web to deploy your node app. But my favorite is heroku cloud to publish nodejs app. It is free for initial level. So Lets start step by step..
Step-1: First of all you have to register on https://www.heroku.com/
Step-2: After login you’ll able to see the dashboard, Then click on plus button top right corner.See below screen shot.
Step-3: Now enter your application name and click on “Create App”.
Step-4: All easy work has been completed. follow all the command which heroku has suggested for your app. before doing make sure that git and heroku toolbelt already installed in your system IF Not follow step 5 and 6.
Step-5: Install git on your machine. I have ubuntu machine so in my case i used “sudo apt-get install git” this command on terminal to install git or you can follow official document https://help.ubuntu.com/lts/serverguide/git.html
Step-6: Install Heroku Toolbelt in your machine, follow heroku official guide to install it on your machine https://toolbelt.heroku.com/
Step-7: Login on heroku from command line type
[email protected]:~$ heroku login Enter your heroku username(emailid) Enter password Hit Enter
Step-8: Go to your node app directory and create file “Procfile” and copy and paste below code
web: node app.js
and save file make sure Procfile should place on root directory of your app. Where app.js is your nodejs main application file which start virtual server.
Server port number should: 5000
Step-9: Go to your app directory from terminal and follow these command suggested my heroku
$ cd my-project/ $ git init $ heroku git:remote -a iamchat
$ git add . $ git commit -m "v1" $ git push heroku master
See final output Your application url look like https://YourApplicationName.herokuapp.com/, In my case https://iamchat.herokuapp.com
Live running my nodejs application on heroku cloud.. https://iamchat.herokuapp.com
Thanks, If you have any query feel free comment on this post, I’ll try to solve your issue. 🙂