Skip to content

Instantly share code, notes, and snippets.

@alphaolomi
Last active August 10, 2019 08:24
Show Gist options
  • Save alphaolomi/0720f16298af55f0fdb9df6d19add9d5 to your computer and use it in GitHub Desktop.
Save alphaolomi/0720f16298af55f0fdb9df6d19add9d5 to your computer and use it in GitHub Desktop.
πŸš€ Getting Started on Heroku with Node.js

Heroku with Node.js

Deploy the app

In this step you will deploy the app to Heroku.

  1. Create an app on Heroku, which prepares Heroku to receive your source code.
heroku create

Creating sharp-rain-871... done, stack is heroku-18 http://sharp-rain-871.herokuapp.com/ | https://git.heroku.com/sharp-rain-871.git Git remote heroku added When you create an app, a git remote (called heroku) is also created and associated with your local git repository.

Heroku generates a random name (in this case sharp-rain-871) for your app, or you can pass a parameter to specify your own app name.

  1. Now deploy your code:
git push heroku master
  1. The application is now deployed. Ensure that at least one instance of the app is running:
heroku ps:scale web=1
  1. Now visit the app at the URL generated by its app name. As a handy shortcut, you can open the website as follows:
heroku open
  1. Check for Logs from Server
heroku logs --tail
  1. Run the app locally
heroku local web
  1. Deploying your app after making changes
git push heroku master
  1. Open the app on the broswer
heroku open cool
  1. Add configs
heroku config:set TIMES=2
  1. Renaming Apps
heroku apps:rename newname

#or

heroku apps:rename newname --app oldname
  1. Updating Git remotes only
git remote rm heroku
heroku git:remote -a newname
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment