- 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 dev development
- It returns the dev database url for you to use locally
- Copy the url from previous step, or run
npm run get-dev-db-url
to refetch the url
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:
1. /data/create-tables.js
- SQL to create needed tables
1. /data/drop-tables.js
- SQL to drop all tables
1. Seed data file - data to load into the db as starter or "seed" data
1. /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
)