Skip to content

chaynsaw/reviews-module

Repository files navigation

Reviews Module

This module is part of the OpenSource Table app. It displays reviews for over 10 million restaurants around the world.

Related Modules

Table of Contents

  1. Usage
  2. Requirements
  3. API

Usage

Deploy with Docker

  • Make sure no images with the names "rdbimg" or "rfeimg", or containers with the names "rdb" or "rfe" exist on the host
  • call 'bash compose'
  • visit port 3010 on the host IP
  • to compose down, use 'bash decompose'... but beware, it will prune any other dangling images and volumes as well.

Plain Node

  • Install the necessary dependencies for this module (npm install)
  • Transpile and bundle all the components (webpack)
  • npm run react-dev if you want to watch for changes
  • If it's your first time downloading the repo, seed the database
  • Start the server (npm run server-dev)
  • The public folder will be available at localhost port 3010

Requirements

An nvmrc file is included if using nvm.

  • Node 6.13.0
  • PostgreSQL 11.2

PostgreSQL

! If re-seeding, run: dropdb reviews

  1. Homebrew is required
  1. Install postgres
  • brew install postgres
  1. Start postgres if it is not already started
  • brew services start postgres
  1. Run the following commands:
  • createdb reviews
  • $ psql reviews
  1. Run the schema file
  • reviews=# \i database/schema.sql
  1. Check out the tables
  • reviews=# \dt
  1. Exit the psql shell
  • reviews=# \q
  1. Go to the config/db_config.js file
  • make the role equal to your local username or whatever is the username of the postgres role that created the database (run 'select * from pg_roles;' in the psql shell [psql reviews to enter the shell again] to see a list of possibilities)
  • if you are running via docker, make the password the POSTGRES_PASSWORD specified as an environment variable in /compose & the host to 'rdb' (whatever will be the name of the container on the netowrk)
  • else, make the password your local postgres password & the host to 'localhost'
  1. Run the seed script (don't forget npm install)
  • npm run seed
  1. Check if the tables populated
  • psql reviews
  • reviews=# select * from reviews;

API

Restful API Routes

Endpoint Type Operation
/:id/reviews GET Get all reviews for a specific restaurant
/:id/reviews POST Create a new review for a specific restaurant
/:id/reviews PUT Edit an existing review for a specific restaurant
/:id/reviews DELETE Delete a review for a specific restaurant

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •