Pages

Monday, 30 November 2020

Deploy Your Code To Heroku App

  1. GitHub To Heroku
  2. Node.js To Heroku 


1. HOW TO DEPLOY AN APP TO HEROKU FROM GITHUB

Follow the steps

  1. Open heroku
  2. Create new app
    • "test" (use required name)
  3. Connect to github
  4. Authorized(for first time)
    • Heroku and git
  5. Search repo 
    • Connect
  6. Enable automatic deploy
  7. Deploy branch
App successfully deployed
You will get url
Like "test.herokuapp.com"


1. HOW TO DEPLOY AN NODE.JS APP TO HEROKU FROM GITHUB


Create a new app in heroku where you want to deploy code

Open gitbase in project location
Or Open New Terminal in VS Code

Commands:

> heroku Login

> touch Procfile 

(If command is not working in terminal, run command in gitbase in project location)

 One file is created named as Procfile

Write following code in Procfile

web: node index.js

If index.js is in src folder give following code

web: node ./src/index.js

> git init

You can copy following code from heroku 

> heroku git: remote -a <app>

> git add .

> git commit -m "put your msg here"

> git push heroku master 


App successfully deployed
You will get url for your app.

Now for any changes You need only to follow three commands:

git add .

git commit -m "put your msg here"

git push heroku master

You will be able to update code.






-- Thanks --

No comments:

Post a Comment

Deploy Your Code To Heroku App

GitHub To Heroku Node.js To Heroku  1. HOW TO DEPLOY AN APP TO HEROKU FROM GITHUB