Last active
November 4, 2017 23:27
-
-
Save shafiqsaaidin/f83768808ae171fb77a95b7253f999ff to your computer and use it in GitHub Desktop.
Heroku Quick Note
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Title : "Getting Started on Heroku with Node.js" | |
Date : "4/11/2017" | |
Author : "Musha" | |
Reference : "https://devcenter.heroku.com/articles/getting-started-with-nodejs" | |
#) Login to heroku | |
$ heroku login | |
#) Deploy the app | |
$ heroku create | |
$ heroku create <name> | |
//push app using git | |
$ git push heroku master | |
// makesure the app is running | |
$ heroku ps:scale web=1 | |
// open app in browser | |
$ heroku open | |
#) View logs | |
$ heroku logs --tail | |
#) Define a Procfile | |
web: node app.js | |
#) Scale the app | |
// Check how many dyno running | |
$ heroku ps | |
// Stop dyno from working | |
$ heroku ps:scale web=0 | |
// Start dyno | |
$ heroku ps:scale web=1 | |
#) Declare app dependencies | |
// Package.json example | |
"dependencies": { | |
"ejs": "2.5.6", | |
"express": "4.15.2" | |
}, | |
// Install dependencies to run locally | |
$ npm install | |
#) Run the app locally | |
$ heroku local web | |
#) Push local changes | |
// push update using git | |
$ git add . | |
$ git commit -m "Test je" | |
$ git push heroku master | |
#) Start a console | |
$ heroku run node | |
$ heroku run bash | |
#) .gitignore | |
/node_modules | |
npm-debug.log | |
.DS_Store | |
/*.env | |
#) Change git remote | |
$ heroku git:remote -a <app-name> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment