Shopping API
Creates the Web API for a very basic e-commerce platform. The server is backed by PostgreSQL database.
APIs
1. GET /product
-
Returns a JSON response with all the events, ordered by date of creation in ascending order.
-
Output
[ { "productid": 5, "productname": "Hammer", "created_at": "2020-11-30T21:46:41.359298" }, { "productid": 4, "productname": "Soap", "created_at": "2020-11-30T21:46:41.359298" } ]
2. POST /orders
-
Accepts a JSON request for an order that comprises one or more tickets.
-
Input
{ "email": "mail@id.com", "line_items": [ { "productid": 4, "quantity": 10 }, { "productid": 5, "quantity": 10 } ] }
3. GET /orders (TODO)
-
Returns a JSON response with all the orders, ordered by date of creation.
-
Output
{ “orders”: [ { “id”: 1, “email”: “test@example.com”, “line_items”: [ { “quantity”: 5, “product”: { “id”: 1, “name”: “Product1” } }, ], } ] }
Description
Languages
Rust
92.6%
PLpgSQL
7.4%