myRetail is a rapidly growing company with HQ in Richmond, VA and over 200 stores across the east coast. myRetail wants to make its internal data available to any number of client devices, from myRetail.com to native mobile apps.
The goal for this exercise is to create an end-to- end Proof-of- Concept for a products API, which will aggregate product data from multiple sources and return it as JSON to the caller.
Your goal is to create a RESTful service that can retrieve product and price details by ID. The URL structure is up to you to define, but try to follow some sort of logical convention.
Click here for a live demonstration of this application
- MongoDB
- Express
- AngularJS
- Node.js
- axios
- Chai and Chai-HTTP for testing
- AngularJS Material for styling
- APIDOC for API Documentation
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.
Steps to get the development environment running.
- Download this project.
npm install
npm start
- Insert following test cases into MongoDB:
{
"_id" : ObjectId("5a866b825079c35e229105b1"),
"product_id" : 16696652,
"current_price" : {
"currency_code" : "USD",
"value" : 113.99
}
}
{
"_id" : ObjectId("5a8674d25079c35e22910836"),
"product_id" : 13860428,
"current_price" : {
"currency_code" : "USD",
"value" : 13.99
}
}
Tests are located in server/tests/server.test.js.
Test can be run by executing npm test.
API documentation is located at localhost:5000/apidoc or on the live demo /apidoc - click here.
Product Found, Update: 404 - Product Does Not Exist: API Documentation Example - (API docs can be found at /apidoc):
High level list of items completed.
- Responds to an HTTP GET request at /products/{id} and delivers product data as JSON (where {id} will be a number.
- Performs an HTTP GET to retrieve the product name from an external API. (For this exercise the data will come from redsky.target.com, but let’s just pretend this is an internal resource hosted by myRetail)
- Reads pricing information from a NoSQL data store and combines it with the product id and name from the HTTP request into a single response.
- Accepts an HTTP PUT request at the same path (/products/{id}), containing a JSON request body similar to the GET response, and updates the product’s price in the data store.
- Marta Jopp