- Fork and clone
https://git.generalassemb.ly/Interapt/project3-backend-starter
cd
into the app andnpm install
- From the command line run
createdb project3-backend-dev
- Run
npm start
.
You have two starter endpoints:
-
GET
api/users
-
POST
api/users
-
Your
config/config/json
is set-up to access the Heroku Postgres production database instance.
{
"development": {
"database": "project3-backend-dev",
"host": "127.0.0.1",
"dialect": "postgres"
},
"production": {
"use_env_variable": "DATABASE_URL",
"dialect": "postgres"
}
}
- This app also has
cors
andnodemon
installed. - Sequelize Cheatsheet
- Fork and clone
https://git.generalassemb.ly/Interapt/project3-frontend-starter
cd
into the app andnpm install
- Run
npm start
. You should see this in the browser:
The app has axios installed. You have one method called getUsers
that hits your Express backend api/users
. Check the browser console for the response.
Heroku Node/Express Deployment Docs
- Also syncing the Sequelize models so that the tables will automatically be created:
var db = require('./models');
db.sequelize.sync();
## Connect Heroku DB to PG Admin
- Right click on
Servers
and select Create > Server...
- On your Heroku App dashboard, click on Heroku Postgres
- On the next screen choose Settings, then View Database Credentials
For security, we'll add the Heroku Postgres URL add heroku env variable to heroku dashboard
- In the
Name
field, enter the name of your database.
-
In the
Connection
Tab:Hostname/Address
is your Heroku PostgresHost
Maintenance Database
is your Heroku PostgresDatabase
Username
is your Heroku PostgresUser
Run this command from your back end app folder: heroku run bash
From here you can run commands like sequelize db:migrate
or sequelize db:seed:all