Reviews API that holds millions of data entries designed to quickly retrieve information for an e-commerce front-end. Tested with K6, loaderIO, and optimized with an Nginx load balancer.
#Built by
-
Optimized web performance using
- Indexing
- Caching
- Horizontally scaling
- Nginx Load Balancer
-
Testing:
- k6
- loaderIO
- Git Fork and Clone this repo
- Open up a new terminal and run the following command to install dependencies:
npm install
- Create a copy of .envCopy replace name to .env
- Replace empty string with youre correct database personal information
- In separate terminals, run the following commands to start server and build webpack bundle
npm run start
- In your browser, go to API:
http://localhost:3000
-
Reviews Endpoint
Get /reviewsReturns a list of reviews for a particular productParameters
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 text 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. { "product": "2", "page": 0, "count": 5, "results": [ { "review_id": 5, "rating": 3, "summary": "I'm enjoying wearing these shades", "recommend": false, "response": null, "body": "Comfortable and practical.", "date": "2019-04-14T00:00:00.000Z", "reviewer_name": "shortandsweeet", "helpfulness": 5, "photos": [{ "id": 1, "url": "urlplaceholder/review_5_photo_number_1.jpg" }, { "id": 2, "url": "urlplaceholder/review_5_photo_number_2.jpg" }, // ... ] },- Meta Data
Get /reviews/metaReturns review metadata for a given product.
Parameters
Parameter Type Description product_id integer Required ID of the product for which data should be returned { "product_id": "2", "ratings": { 2: 1, 3: 1, 4: 2, // ... }, "recommended": { 0: 5 // ... }, "characteristics": { "Size": { "id": 14, "value": "4.0000" }, "Width": { "id": 15, "value": "3.5000" }, "Comfort": { "id": 16, "value": "4.0000" }, // ... } - Meta Data

