项目作者: christian0101

项目描述 :
Development server for students completing stage three of the restaurant reviews project for Mobile Web Specialist Nanodegree
高级语言: JavaScript
项目地址: git://github.com/christian0101/mws-restaurant-stage-3.git
创建时间: 2018-04-06T12:31:18Z
项目社区:https://github.com/christian0101/mws-restaurant-stage-3

开源协议:

下载


Local Development API Server

My solution

https://restaurant-reviews-client.herokuapp.com

Also check cloud-server and cloud-api branches for source code.

Usage

Get Restaurants

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

Get Restaurants by id

  1. 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

```Install project dependancies

npm i

  1. ###### Install Sails.js globally
  2. ```Install sails global
  3. # npm i sails@0.12.14 -g
Start the api server

```Start node api server

node server

  1. ###### Start python web server (requires python3)
  2. ```Start python web server (requires python3)
  3. # python server.py

You should now have access to your API server environment and web server

  1. **API**
  2. debug: Environment : development
  3. debug: Port : 1337
  4. **WEB**
  5. Port : 8000
  6. ## Endpoints
  7. ### GET Endpoints
  8. #### Get all restaurants

http://localhost:1337/restaurants/

  1. #### Get favorite restaurants

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

  1. #### Get a restaurant by id

http://localhost:1337/restaurants/

  1. #### Get all reviews for a restaurant

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

  1. #### Get all restaurant reviews

http://localhost:1337/reviews/

  1. #### Get a restaurant review by id

http://localhost:1337/reviews/

  1. #### Get all reviews for a restaurant

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

  1. ### POST Endpoints
  2. #### Create a new restaurant review

http://localhost:1337/reviews/

  1. ###### Parameters

{
“restaurant_id”: ,
“name”: ,
“rating”: ,
“comments”:
}

  1. ### PUT Endpoints
  2. #### Favorite a restaurant

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

  1. #### Unfavorite a restaurant

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

  1. #### Update a restaurant review

http://localhost:1337/reviews/

  1. ###### Parameters

{
“name”: ,
“rating”: ,
“comments”:
}

  1. ### DELETE Endpoints
  2. #### Delete a restaurant review

http://localhost:1337/reviews/
```

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 :)