Deploying Node.js/Express.js 
applications with a Postgresql/Knex.js database

Environment variables

Only supports your local DB:

Supports local DB and heroku DB:

Environment variables continued

Local env variable

Heroku env variable

Use production Database Environment

For the time being just hardcode 'production' when targeting your DB environment

You should really have at least 2 database environments 'development' and 'production' 
and then use a local environment variable to use 'development' and a Heroku environment variable to use 'production' 

Create two database environments in your knexfile.js and create a DB_ENV variable locally and for heroku

Key commands (available in the exercise README.md - no need to take node now)

Creating the heroku app followed by creating the postgresql database for your heroku app

Key commands (available in the exercise README.md - no need to take node now)

* After adding/commit/pushing
to heroku *

Run migrations via Heroku
Run seeds via Heroku

Done ! 

Exercise

https://github.com/AkyunaAkish/deployingToHerokuWithPostgresqlAndKnex

Fork and clone this repo and follow the README.md:

No need to make a pull request

STRETCH GOAL: Follow the same process to deploy your apps from Fridays Hackathon

Heroku #3 Deploying

By Lucas Nascimento

Heroku #3 Deploying

  • 453