This is a node/express application that provides a REST API for the Atelier ecommerce frontend.
The database schema are contained in /etl
The node server is contained entirely in /server
and enters on index.js
npm test
runs the tests inside of the /test
folder with jest
Ensure the database is prepared - ETL
npm install
copy example.env
to .env
and configure the variables within.
npm start
npm test
All Queries take parameters as Query strings unless it is in the endpoint
All responses should return status code 200 OK
Retrieve a list of products
Parameter | Type | Description |
---|---|---|
page | Integer | Selects the page of results to return. Default 1. |
page_size | Integer | Specifies how many results per page to return. Default 10. |
[
{
"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
},
{
"id": 3,
"name": "Morning Joggers",
"slogan": "Make yourself a morning person",
"description": "Whether you're a morning person or not. Whether you're gym bound or not. Everyone looks good in joggers.",
"category": "Pants",
"default_price": 40
}
]
Returns all product level information for a specified product id.
Parameter | Type | Description |
---|---|---|
product_id | Integer | Required ID of the product for which data should be returned. |
{
"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,
"features": [
{
"feature": "Buttons",
"value": "Brass"
},
{
"feature": "Fabric",
"value": "Canvas"
}
]
}
Returns the all styles available for the given product.
Parameter | Type | Description |
---|---|---|
product_id | Integer | Required ID of the product for which data should be returned |
{
"product_id": "1",
"results": [
{
"style_id": 1,
"name": "Forest Green & Black",
"original_price": 140,
"sale_price": null,
"default?": true,
"photos": [
{
"url": "placeholder/image.jpg",
"thumbnail_url": "placeholder/image_thumbnail.jpg"
},
{
"url": "placeholder/image.jpg",
"thumbnail_url": "placeholder/image_thumbnail.jpg"
}
],
"skus": {
"1": {
"quantity": 8,
"size": "XS"
},
"2": {
"quantity": 16,
"size": "S"
}
}
},
{
"style_id": 2,
"name": "Desert Brown & Tan",
"original_price": 140,
"sale_price": null,
"default?": false,
"photos": [
{
"url": "placeholder/image.jpg",
"thumbnail_url": "placeholder/image_thumbnail.jpg"
},
{
"url": "placeholder/image.jpg",
"thumbnail_url": "placeholder/image_thumbnail.jpg"
}
],
"skus": {
"7": {
"quantity": 16,
"size": "S"
},
"8": {
"quantity": 8,
"size": "XS"
}
}
}
]
}
Returns the id's of products related to the product specified.
Parameter | Type | Description |
---|---|---|
product_id | Integer | Required ID of the product for which data should be returned |
[
2,
3,
8,
7
]