Created
June 16, 2019 12:03
-
-
Save daniil4udo/7d4f750a79e65ea2dd1748be45e49abf to your computer and use it in GitHub Desktop.
Deploying to Heroku
This file contains 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
# Implying you already have Heroku CLI | |
# Create Procfile & add script from package.json to run | |
touch Procfile | |
echo > "web: npm run prod" Procfile | |
# Create new app | |
heroku create | |
# Add config variable | |
heroku config:set NODE_ENV=production | |
# List all env variables (useful for setting secret tokens or key, that you dont want keep in you codebase) | |
heroku config | |
# Also set your port in you server configuration file to | |
# const PORT = process.env.PORT || 8080; | |
# If doesnt exist | |
touch .env | |
echo "NODE_ENV=production" > .env | |
# Check | |
heroku local | |
# If ready for prod | |
git push heroku heroku:master | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment