Git Product home page Git Product logo

fsjnd-buildastorefrontbackend's Introduction

FSJND - Build A Storefront Backend


How to build

$ git clone https://github.com/raymondngiam/FSJND-BuildAStorefrontBackend.git
$ cd FSJND-BuildAStorefrontBackend
$ npm install
$ npm run build

Setup database

  1. Default installation of PostgreSQL would be running at the TCP/IP address of 127.0.0.1:5432. This can be verified with the following bash command:

    $ sudo netstat -plunt | grep postgres
    tcp        0      0 127.0.0.1:5432          0.0.0.0:*               LISTEN      991/postgres 
  2. To setup the database for this application, first start a terminal and change user to postgres.

    $ sudo -iu postgres
    postgres $ 
  3. Start psql

    postgres $ psql
    postgres=# 
  4. Create a new user shopping_user in the psql prompt with the following command:

    postgres=# CREATE USER shopping_user WITH PASSWORD 'password123';
    
  5. Create two databases

    postgres=# CREATE DATABASE shopping_dev;
    postgres=# CREATE DATABASE shopping_test;
    
  6. Connect to the database shopping_dev

    postgres=# \c shopping_dev
    You are now connected to database "shopping_dev" as user "postgres".
    shopping_dev=#
    
  7. Grant permission on SCHEMA (of the current database) to the user:

    shopping_dev=# GRANT ALL ON SCHEMA public TO shopping_user;
    
  8. Connect to the database shopping_test

    postgres=# \c shopping_test
    You are now connected to database "shopping_test" as user "postgres".
    shopping_test=#
    
  9. Grant permission on SCHEMA (of the current database) to the user:

    shopping_test=# GRANT ALL ON SCHEMA public TO shopping_user;
    
  10. Quit psql

    shopping_test=# \q
    

Running migrations

  1. To setup the migration:

    $ db-migrate --env dev up
  2. To tear down the migration:

    $ db-migrate --env dev reset

How to run test and start up the server

$ npm run test
$ node dist/server.js

fsjnd-buildastorefrontbackend's People

Contributors

raymondngiam avatar

Watchers

James Cloos avatar  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.