How To Deploy you API to Heroku
Clone or download
Latest commit 5bd256d Feb 18, 2020
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
README.md Update README.md Feb 18, 2020

README.md

Heroku-Setup

How To Deploy you API to Heroku

If you don't have a Heroku account sign up for it at (www.heroku.com)

Initialize your app

heroku create your-heroku-app-name

Re-init your git

git init

make sure you set up your heroku path

heroku git:remote -a your-heroku-app-name

set your buildpack to nodejs

heroku buildpacks:set heroku/nodejs
heroku addons:create heroku-postgresql:hobby-dev --app=your-heroku-app-name

check your status in case you need to commit

git status
git commit -am "add any pending changes"
git push heroku master
heroku run npx sequelize-cli db:migrate
heroku run npx sequelize-cli db:seed:all

possible errors:

app crashed at '/' or '/api' might be caused by not having a start script in your package.json

also "nodemon server.js" needs to be changed to "node server.js" since you specified nodejs as your buildpack

common error codes

(https://devcenter.heroku.com/articles/error-codes#h10-app-crashed) (https://dev.to/lawrenceagles/causes-of-heroku-h10-app-crashed-error-and-how-to-solve-them-3jnl)

ERROR: Application not supported by 'heroku/nodejs' buildpack

You need to add node version to your .JSON

node --version

Add to PACKAGE.JSON under description:

  "engines": {
    "node": "13.2.0"
  },

Heroko doesn't seem to like it when you're not pushing from master branch