Skip to content

Development server for students completing stage three of the restaurant reviews project for Mobile Web Specialist Nanodegree

Notifications You must be signed in to change notification settings

alex-ahumada/mws-restaurant-stage-3

 
 

Repository files navigation

Local Development API Server

Lighthouse reports

Local Lighthouse reports and screen captures are located in /lighthouse_reports. This has been included as a reviewer request, he/she was getting different scores.

Usage

Get Restaurants

curl "http://localhost:1337/restaurants"

Get Restaurants by id

curl "http://localhost:1337/restaurants/{3}"

Architecture

Local server

  • Node.js
  • Sails.js

Contributors

Getting Started

Development local API Server

Location of server = /server Server depends on node.js LTS Version: v6.11.2 , npm, and sails.js Please make sure you have these installed before proceeding forward.

Great, you are ready to proceed forward; awesome!

Let's start with running commands in your terminal, known as command line interface (CLI)

Install project dependancies
# npm i
Install Sails.js globally
# npm i sails -g
Start the server
# node server

You should now have access to your API server environment

debug: Environment : development debug: Port : 1337

Gulp tasks

Default task

Launches BrowserSync and watch SCSS, JS, and template changes. Saves minified and GZipped copies.

# gulp default

Image processing

Task to process images and save a .webp copy.

# gulp images

Endpoints

GET Endpoints

Get all restaurants

http://localhost:1337/restaurants/

Get favorite restaurants

http://localhost:1337/restaurants/?is_favorite=true

Get a restaurant by id

http://localhost:1337/restaurants/<restaurant_id>

Get all reviews for a restaurant

http://localhost:1337/reviews/?restaurant_id=<restaurant_id>

Get all restaurant reviews

http://localhost:1337/reviews/

Get a restaurant review by id

http://localhost:1337/reviews/<review_id>

Get all reviews for a restaurant

http://localhost:1337/reviews/?restaurant_id=<restaurant_id>

POST Endpoints

Create a new restaurant review

http://localhost:1337/reviews/
Parameters
{
    "restaurant_id": <restaurant_id>,
    "name": <reviewer_name>,
    "rating": <rating>,
    "comments": <comment_text>
}

PUT Endpoints

Favorite a restaurant

http://localhost:1337/restaurants/<restaurant_id>/?is_favorite=true

Unfavorite a restaurant

http://localhost:1337/restaurants/<restaurant_id>/?is_favorite=false

Update a restaurant review

http://localhost:1337/reviews/<review_id>
Parameters
{
    "name": <reviewer_name>,
    "rating": <rating>,
    "comments": <comment_text>
}

DELETE Endpoints

Delete a restaurant review

http://localhost:1337/reviews/<review_id>

If you find a bug in the source code or a mistake in the documentation, you can help us by submitting an issue to our Waffle Dashboard. Even better you can submit a Pull Request with a fix :)

About

Development server for students completing stage three of the restaurant reviews project for Mobile Web Specialist Nanodegree

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 68.8%
  • CSS 15.8%
  • HTML 15.4%