Our 3 software engineers rebuilt back-end API service for a monolithic to service-oriented micorservices to support our existing e-commerce site in this project. The service I built was scaled to meet the demands of production traffic with 6000RPS with < 40ms response time with 0% error rate.
Backend Development: Node.js | Express | Postgres | NGINX
Deployement: Docker | AWS EC2
Testing: Jest | SuperTest | K6 | Loader.io
Returns a list of reviews for a particular product. This list does not include any reported reviews.
GET /reviews/
Query Parameters
| Parameter | Type | Description |
|---|---|---|
| product_id | integer | Specifies the product for which to retrieve reviews. |
| 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" |
Response: Status: 200 OK
Returns review metadata for a given product.
GET /reviews/meta
Query Parameters
| Parameter | Type | Description |
|---|---|---|
| product_id | integer | Required ID of the product for which data should be returned |
Response: Status: 200 OK
Adds a review for the given product.
POST /reviews
Query Parameters
| Parameter | Type | Description |
|---|---|---|
| product_id | integer | Required ID of the product to post the review for |
| rating | int | Integer (1-5) indicating the review rating |
| summary | text | Summary text of the review |
| body | text | Continued or full text of the review |
| recommend | bool | Value indicating if the reviewer recommends the product |
| name | text | Username of reviewer |
| text | Email address of reviewer | |
| photos | [text] | Array of text urls that link to images to be shown |
| characteristics | object | Object of keys representing characteristic_id and values representing the review value for that characteristic. { "14": 5, "15": 5 //...} |
Response: Status: 201 Created
Updates a review to show it was found helpful.
PUT /reviews/:review_id/helpful
Query Parameters
| Parameter | Type | Description |
|---|---|---|
| review_id | integer | Required ID of the review to update |
Response: Status: 204 NO CONTENT
Updates a review to show it was reported. Note, this action does not delete the review, but the review will not be returned in the above GET request.
PUT /reviews/:review_id/report
Query Parameters
| Parameter | Type | Description |
|---|---|---|
| review_id | integer | Required ID of the review to update |
Response: Status: 204 NO CONTENT
- Run
node db/schema.jsto create tables - Run
node db/loadingData.jsto import data from csv files (if deployed to cloud, run copyData-AWS-EC2.sql instead). Make sure to replace the file paths with your paths
- Create database
- Create file named
schema.sqland copy commands fromdb/schema.sql - Create file name
loadingData.sqland copy commands fromdb/loadingData.sql - Run
psql -h localhost -U your-user-name -d your-cloud-database-name -f \schema.sql - Transfer the CSV files from local to cloud server
- Run
psql -h localhost -U your-user-name -d your-cloud-database-name-f \importData.sql`
- In the terminal inside, run
npm run server/index.jsto start server - Test by typing
http://localhost:8000/reviews?product_id=1in the Postman to see the response.
Please reference other API Services that make up the other part of the e-commerce app API:
-
Product Overviews by Yui Murayama
-
Q&A by Yuchen Pan






