An e-commerce microservice api which has the following features:
- Get list of available products
- Get products in a users cart
- Put products in a users cart
- System packages: nodejs, npm
- npm packages: express, request, body-parser
-
Clone into the working repository
git clone https://github.com/ManeeshD07/Micorservices-ESA.git
-
Install the necessary npm packages and dependencies
npm install express request body-parser --save
-
To start the server run :
node server.js
-
On the client side you can choose out of three possible test cases:
-
Product Microservice :
- Retrieve product list:
-
User Cart Microservice :
- Add/update cart items :
PUT /rest/v1/users/<uuid>/cart
Host: http://localhost:3000
Content-type: application/json
{
"productId":"<product id number>",
"quantity":"<number of items>"
}For curl users:
curl -X PUT http://localhost:3000/rest/v1/users/\<uuid>/cart -H "Content-type: application/json" -d '{"productId":"<product id number>","quantity":"<number of items>"}'
- Get cart items :
http://localhost:42069/rest/v1/users/\<uuid>/cart
-