I worked with another software engineer to rebuild back-end API service from a monolithic to service-oriented microservices to support our existing e-commerce application in this project. The service I built was scaled to meet the demands of production traffic which is 2000rps with < 1s response time with 0% error rate.
Backend Development: Node.js, Express, Postgres, NGINX
Deployment: Docker, AWS EC2
Testing: Jest, SuperTest, K6, Loader.io, New Relic
Returns a list of all products of the retail website.
GET /products/
Response: Status: 200 OK
[
{
"id": 1,
"name": "Camo Onesie",
"slogan": "Blend in to your crowd",
"description": "The So Fatigues will wake you up and fit you in. This high energy camo will have you blending in to even the wildest surroundings.",
"category": "Jackets",
"default_price": "140"
},
{
"id": 2,
"name": "Bright Future Sunglasses",
"slogan": "You've got to wear shades",
"description": "Where you're going you might not need roads, but you definitely need some shades. Give those baby blues a rest and let the future shine bright on these timeless lenses.",
"category": "Accessories",
"default_price": "69"
},
...
]
Return details of a single product
GET /products/:product_id
Query Parameters
Parameter | Type | Description |
---|---|---|
product_id | integer | Required ID of the product for which data should be returned |
Response: Status: 200 OK
{
"id": 11,
"name": "Air Minis 250",
"slogan": "Full court support",
"description": "This optimized air cushion pocket reduces impact but keeps a perfect balance underfoot.",
"category": "Basketball Shoes",
"default_price": "0",
"features": [
{
"feature": "Sole",
"value": "Rubber"
},
{
"feature": "Material",
"value": "FullControlSkin"
},
// ...
],
}
Return all styles of single product
GET /products/:product_id/styles
Query Parameters
Parameter | Type | Description |
---|---|---|
product_id | integer | Required ID of the product for which data should be returned |
Response: Status: 200 OK
{
"product_id": "1",
"results": [
{
"style_id": 1,
"name": "Forest Green & Black",
"original_price": "140",
"sale_price": "0",
"default?": true,
"photos": [
{
"thumbnail_url": "urlplaceholder/style_1_photo_number_thumbnail.jpg",
"url": "urlplaceholder/style_1_photo_number.jpg"
},
{
"thumbnail_url": "urlplaceholder/style_1_photo_number_thumbnail.jpg",
"url": "urlplaceholder/style_1_photo_number.jpg"
}
// ...
],
"skus": {
"37": {
"quantity": 8,
"size": "XS"
},
"38": {
"quantity": 16,
"size": "S"
},
"39": {
"quantity": 17,
"size": "M"
},
//...
}
},
// ...
}
Return all related products' id of single product
GET /products/:product_id/related
Query Parameters
Parameter | Type | Description |
---|---|---|
product_id | integer | Required ID of the product for which data should be returned |
Response: Status: 200 OK
[2,3,5,6]
- In the terminal inside, run
npm run start
to start server - Test by typing
http://localhost:5000/products
in the Postman to see the response.
Please reference Questions & Answers API Services that make up the Project Atelier API:
- Questions & Answers by Alan Li