Module smart_fridge::http
source · Expand description
Module that manage all the web API.
Routes
| METHOD | ROUTE | DESCRIPTION | RETURN |
|---|---|---|---|
| GET | /api/v2/healthcheck | Used to check the health of the http server | (200, body: “OK”) |
| GET | /api/v2/food | Get all row/food from the database | (200, body: JSON) or 500 |
| POST | /api/v2/food | Add food in the database | 204 or 500 |
| GET | /api/v2/food/:uuid | Get one row/food from the database | (200, body: JSON) or 500 |
| DELETE | /api/v2/food/:uuid | Delete on row/food in the database | 204 or 500 |
Modules
- Module that manages any internal errors that may occur.
- Module that represent
Foodin a fridge. - Define function that will react to each request according the route.
Functions
- Defines and returns the router of the app.