This node.js API provides price information on a variety of retail products.
-
Clone this repository from github
git clone https://github.com/dkleingit/myretail.git
-
Install mongodb (this will store the pricing information)
-
Install Dependencies
$ npm install
-
Load the data
$ node loader.js
Pricing information will be loaded for the following product ids:
[13860424, 13860425, 13860428, 13860429, 13860433]
-
Run the tests
$ npm test
-
Start the server
$ node server.js
HTTP GET request at /products/{id}
Delivers product data as JSON where {id} is a number.
HTTP PUT request at /products/{id}
Updates the product's price in the data store and returns the updated record.
Example Request:
http://localhost:8080/products/13860428
Example Response:
{"id":13860428,"name":"The Big Lebowski (Blu-ray) (Widescreen)","current_price":{"value": 13.49,"currency_code":"USD"}}