Get #Amazon #Prime for this #holiday #amazonprime #christmas #2019

#Hosting - How to host a #Nodejs app on #Heroku?

There is an official list of tutorials on Heroku site that guide users on uploading their apps.
Since the app I uploaded was a Nodejs app. I will list them briefly the steps I took to upload my app.
  1. Create a Heroku account
  2. Make sure that node, npm and git are installed. You can checked via
    node -v, npm -v and git --version
  3. Download Heroku cli tool
  4. Set your listening port to process env PORT variable
    var port = process.env.PORT
  5. Login using your terminal 
    heroku login
  6. Set up a profile file
    Procfile: a text file in the root directory of your app that explicitly tells what command should be executed to start your app.
    The web command tells that this app process will be on Heroku HTTP routing stack and receive web traffic when deployed.
    For example:
    web: node index.js
  7. In your Nodejs app, run
    heroku create
    // heroku create is a shorthand alias for heroku apps:create. You can see a list // of all commands with heroku help.
  8. Note: creating a named app. Refer Heroku creating apps document.
    heroku create example // example is the name of the app
    Creating ⬢ example... done
    https://example.herokuapp.com/ | https://git.heroku.com/example.git
  9. Push your app to heroku branch
    git push heroku master
  10. Set an instance of the application alive
    heroku ps:scale web=1
  11. Open your app
    Set an instance of the application alive
    heroku open

Information:
  1. To log
    heroku logs --tail
  2. To see remaining hours available
    heroku ps -a <app name>
  3. When we add new dependency and routes
    heroku login
    npm install
    heroku local
    git add .
    git commit -m 'commit'
    git push heroku master
  4. Sometimes, heroku dynos are down. You can check heroku status via https://status.heroku.com/.

    Heroku App Status

  5. To delete a heroku app,
    Login and click the navigator toggle icon next to your account icon on the top right.
    Select dashboard and you will see all your apps.
    Select the app that you want to delete.
    Select Settings on the menu bar.
    Then, scroll all the way down and you will see 'delete app' button.
    Click and type in your app's name to delete your app. It can't be undo.
Heroku dashboard
Heroku Dashboard

Heroku - where to delete app
Heroku - where to delete app


Thank you for reading!

Jun