NewGit
Sign in
fe2ef985
api.md 23 lines295 B

API

GET /products

Returns every product.

[{"id": 1, "name": "Notebook", "price": 4.5, "discount": 0}]

POST /cart

{"product_id": 1, "quantity": 2}

Returns 201 with no body.

GET /cart

{"items": [{"product_id": 1, "quantity": 2}], "total": 9}
Source
 1# API
 2
 3## GET /products
 4
 5Returns every product.
 6
 7```json
 8[{"id": 1, "name": "Notebook", "price": 4.5, "discount": 0}]
 9```
10
11## POST /cart
12
13```json
14{"product_id": 1, "quantity": 2}
15```
16
17Returns 201 with no body.
18
19## GET /cart
20
21```json
22{"items": [{"product_id": 1, "quantity": 2}], "total": 9}
23```