GithubHelp home page GithubHelp logo

rachciar / lesson-w11d01-heroku-backend-starter Goto Github PK

View Code? Open in Web Editor NEW

This project forked from marcwright/lesson-w11d01-heroku-backend-starter

0.0 1.0 0.0 6.34 MB

JavaScript 93.20% CSS 1.95% HTML 4.84%

lesson-w11d01-heroku-backend-starter's Introduction

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

lesson-w11d01-heroku-backend-starter's People

Contributors

marcwright avatar

Watchers

 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.