As we know deploy an Application to production is very difficult to a programmer but wait... the solution is here in today's world there are many tools and services out there to solve the problems.
Like :- AWS , Azure , Google Cloud and etc.
So, in this blog i m going to show you how to deploy Node.js Application to the Production Environment using Heroku .
Heroku is a Cloud platform as a service (PaaS) which is use for deliver, monitor, and scale apps. For More Click Here
Prerequisite
- Create an Account on Heroku -> create account
- And make sure Git install on you system -> Git Download
- Then Download Heroku CLI -> Heroku CLI
Setps
- Open CMD and type
$ heroku --version
. - Now type
$ heroku login
and now it's open your browser and ask for the login so login into it and close browser. - Then create a node.js project
$ npx create-react-app my-app
. - And go to to app folder
$ cd my-app
. - Now we deploy our App to the Heroku type
$ heroku create
. - After this type
$ git push heroku main
. - Now our app is deploy successfully on Heroku.
- Now visit the app at the URL generated by its app name.
- Type in CMD
$ heroku open
.
Ok So we have done this work Successfully i hope you Learn from it.