- fork this repo
- clone your fork of this repo onto your local computer somewhere outside the class repo
cd
into the local repo- don't forget to run
npm install
- open your postgres app and start the db server
-
in your terminal, if running
psql
gives you "command not found", runln -s /Applications/Postgres.app/Contents/Versions/latest/bin/psql /usr/local/bin/psql
-
in the postgres app, double click one of the existing databases to enter
psql
-
once inside
psql
, run:CREATE DATABASE contacts;
\c contacts
CREATE TABLE people (id SERIAL, name VARCHAR(16), age INT);
INSERT INTO people ( name, age ) VALUES ( 'Matt', 38 );
INSERT INTO people ( name, age ) VALUES ( 'Sally', 54 );
INSERT INTO people ( name, age ) VALUES ( 'Zanthar', 4892 );
- run
nodemon
go to http://localhost:3000/ to view local app (note this uses your local database)
confirm all CRUD functionality
- run
heroku create
(take note of the app name for later)
- go to heroku.com in your browser and sign in
- find this newly created heroku app in your list of available apps and click on it
- go to resources to use the
Add-ons
search bar - search for postgres and choose Heroku Postgres
- choose "Hobby Dev - Free"
- click provision
- run
heroku pg:psql
- once inside heroku's psql, run
CREATE TABLE people (id SERIAL, name VARCHAR(16), age INT);
INSERT INTO people ( name, age ) VALUES ( 'Matt', 38 );
INSERT INTO people ( name, age ) VALUES ( 'Sally', 54 );
INSERT INTO people ( name, age ) VALUES ( 'Zanthar', 4892 );
- exit heroku psql with
\q
- run
git push heroku master
- run
heroku open
to see app (note this uses your heroku postgres database, which will have different data than your local db)
Open Postgres app and start the db
In terminal:
- Go to repo root dir
- Run
nodemon
In Browser go to http://localhost:3000/