jwatkins0101 / project3-backend-starter

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

GA Logo

Project 3 Backend Starter Code

Project 3 Starter Code Links


Express Backend Set-up

To Install

  • Fork and clone https://git.generalassemb.ly/Interapt/project3-backend-starter
  • cd into the app and npm install
  • From the command line run createdb project3-backend-dev
  • Run npm start.

Starter End Points

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"
  }
}

Test the endpoints with Postman


React Frontend Set-up

To Install

  • Fork and clone https://git.generalassemb.ly/Interapt/project3-frontend-starter
  • cd into the app and npm install
  • Run npm start. You should see this in the browser:

Axios

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

Create Free Heroku Account

Heroku Homepage

Install the Heroku CLI

Install Docs

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

Heroku Stuff

  • 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

Database URL

For security, we'll add the Heroku Postgres URL add heroku env variable to heroku dashboard

PG Admin Stuff

  • In the Name field, enter the name of your database.

  • In the Connection Tab:

    • Hostname/Address is your Heroku Postgres Host
    • Maintenance Database is your Heroku Postgres Database
    • Username is your Heroku Postgres User


Connect to your production server Terminal

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

https://project3-backend-test.herokuapp.com/users

Additional Resources

About


Languages

Language:JavaScript 93.2%Language:HTML 4.8%Language:CSS 2.0%