Giter VIP home page Giter VIP logo

pern-stack's Introduction

Steps to Create and Deploy:

set up local

in your browser

  1. fork this repo

in your terminal

  1. clone your fork of this repo onto your local computer somewhere outside the class repo
  2. cd into the local repo
  3. don't forget to run npm install

local postgres

  1. open your postgres app and start the db server

if you deleted your old "contacts" database from class

  1. in your terminal, if running psql gives you "command not found", run ln -s /Applications/Postgres.app/Contents/Versions/latest/bin/psql /usr/local/bin/psql

  2. in the postgres app, double click one of the existing databases to enter psql

  3. once inside psql, run:

    1. CREATE DATABASE contacts;
    2. \c contacts
    3. CREATE TABLE people (id SERIAL, name VARCHAR(16), age INT);
    4. INSERT INTO people ( name, age ) VALUES ( 'Matt', 38 );
    5. INSERT INTO people ( name, age ) VALUES ( 'Sally', 54 );
    6. INSERT INTO people ( name, age ) VALUES ( 'Zanthar', 4892 );

in your terminal

  1. run nodemon

in your browser

go to http://localhost:3000/ to view local app (note this uses your local database)

confirm all CRUD functionality

set up heroku

in your terminal

  1. run heroku create (take note of the app name for later)

in your browser

  1. go to heroku.com in your browser and sign in
  2. find this newly created heroku app in your list of available apps and click on it
  3. go to resources to use the Add-ons search bar
  4. search for postgres and choose Heroku Postgres
  5. choose "Hobby Dev - Free"
  6. click provision

in your terminal

  1. run heroku pg:psql
  2. once inside heroku's psql, run
    1. CREATE TABLE people (id SERIAL, name VARCHAR(16), age INT);
    2. INSERT INTO people ( name, age ) VALUES ( 'Matt', 38 );
    3. INSERT INTO people ( name, age ) VALUES ( 'Sally', 54 );
    4. INSERT INTO people ( name, age ) VALUES ( 'Zanthar', 4892 );
  3. exit heroku psql with \q
  4. run git push heroku master
  5. run heroku open to see app (note this uses your heroku postgres database, which will have different data than your local db)

Rerunning local after initial set up

Open Postgres app and start the db

In terminal:

  1. Go to repo root dir
  2. Run nodemon

In Browser go to http://localhost:3000/

pern-stack's People

Contributors

krafalski avatar mahuntington avatar

Stargazers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.