- Create a new GitHub repo from this template
- Clone your repo down, cd into the directory and open vscode
- In the terminal, run
npm i
to install dependencies. - Copy
.env-example
as.env
- Run
heroku create
- Run
npm run setup-heroku
to create:- A production heroku SQL database in the cloud to go with your heroku app
- A second dev heroku SQL database in the cloud to use when doing local development
- It returns the
DEV_DATABASE_URL
- Copy the
DEV_DATABASE_URL
from previous step, or runnpm run get-dev-db-url
to refetch the url
- ACP your main branch
- Work on a new branch:
git checkout -b dev
(orfeature-name
orday-02
, etc.)
There are package.json
script for running parts or all of your db setup:
npm run create-tables
- create SQL tablesnpm run drop-tables
- drop SQL tablesnpm run recreate-tables
- drop and create SQL tablesnpm run load-seed-data
- load seed datanpm run setup-db
- recreate tables and load seed data
Use these scripts while developing your db model. Inspect progress using PGAdmin Tool. Remember, it
should be okay to re-run whole process. The purpose of setup-db
is to restore your db to a know "setup" state.
Change all the files in the data
directory to match the data model of your app:
/data/create-tables.js
- SQL to create needed tables/data/drop-tables.js
- SQL to drop all tables- Seed data file - data to load into the db as starter or "seed" data
/data/load-seed-data.js
- SQL to insert each item from the seed data array
- Run
npm run start:watch
to start the dev server in watch mode
/__tests__/app.test.js
contains testing file for routes. It has before code to run your db setup and after code to close the db connection- Use
npm run test:watch
to start tests in watch mode - Routes go in
app.js
(notserver.js
)