8000 GitHub - SDC-Madrone/reviews-api: Atelier API endpoint for product reviews
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

SDC-Madrone/reviews-api

Branches< 8000 a type="button" href="/SDC-Madrone/reviews-api/tags" class="prc-Button-ButtonBase-c50BI OverviewContent-module__Button--MDoYP" data-loading="false" data-size="medium" data-variant="invisible" aria-describedby=":Rklab:-loading-announcement">Tags

Repository files navigation

Atelier Reviews API

Endpoint for product reviews

Dependencies:

  • express v4.17.1
  • mysql2 v2.3.3
  • nodemon v2.0.15
  • dotenv v10.0.0

Local requirements and setup:

  • Node.js ≥ v14
  • MySQL ≥ v5.7

After forking and cloning down the repo, create a .env file in the root directory with the same keys listed in dotenv.example.txt. Ensure that the .env file is gitignored.

Run the following commands from the root directory:

$ npm install

to install all necessary dependencies

$ mysql -u <username> -p <password> < database/schema.sql

to seed the database schema
Ensure the mysql server on your machine is running and then

$ npm start

to start the nodemon server.

For load balancing setup, see nginx.example.conf.

List Reviews:

Returns a list of reviews for a particular product. This list does not include any reported reviews.

GET /reviews
Query parameters:

Parameter Type Description
page integer Selects the page of results to return - default 1
count integer Specifies how many results per page to return - default 5.
sort string Changes the sort order of reviews to be based on "newest", "helpful", or "relevant"
product_id integer Specifies the product for which to retrieve reviews.

Response:
Status: 200 OK

Add a Review:

Adds a review for the given product.

POST /reviews
Body parameters:

Parameter Type Description
product_id integer Required ID of the product to post the review for
rating integer 1-5 indicating the review rating
summary string (optional) Summary text of the review - if none, the empty string "" should be sent
body string Continued or full text of the review
recommend boolean Value indicating if the reviewer recommends the product
name string Username for question asker
email string Email address for question asker
photos JSON array Array of string urls that link to images to be shown
characteristics JSON object Object of keys representing characteristic_id and values representing the review value for that characteristic. { "14": 5, "15": 5 //...}

Response:
Status: 201 CREATED

About

Atelier API endpoint for product reviews

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published
0