This is a simple shopping cart API in node built using event sourcing
## Concepts
A product consists of:
- An ID
- A name
- A description
- A price
{
"id": 1,
"name": "Awesome Red Pen",
"description": "The most awesome red pen you will ever see!",
"price": 10
}
A cart item consists of:
- An ID
- A quantity
- A product ID
- A product name
- A product description
- A unit price
- A line total
{
"id": 2,
"quantity": 2,
"name": "Awesome Red Pen",
"description": "The most awesome red pen you will ever see!",
"price": 10,
"total": 20
}
#### Cart Item Events
- CartItemCreated
- CartItemQuantityUpdate
- CartItemDeleted
A cart consists of:
- An ID
- A collection of cart items
- A total
{
"id": 3,
"total": 20
}
POST
to http://localhost:3000/carts/:cartID/items
{
"id": 1,
"quantity": 4
}
PUT
to http://localhost:3000/carts/:cartID/items/9999
{
"id": 1,
"quantity": 4
}
GET
to http://localhost:3000/carts/1/items