4 stable releases

2.0.0 Oct 4, 2023
1.2.1 Sep 13, 2023
1.0.0 Sep 13, 2023

#613 in HTTP server

Download history 3/week @ 2024-02-25 53/week @ 2024-03-10 2/week @ 2024-03-17 40/week @ 2024-03-31

95 downloads per month

MIT license

28KB
449 lines

Run

Before Running:

export DATABASE_PASSWORD=fridge

Then run:

docker compose up

Environment

Default environment variables per level:

variables application docker compose My env or .env
DATABASE_ADDR db db localhost
DATABASE_NAME postgres postgres
DATABASE_USERNAME postgres postgres fridge
DATABASE_PASSWORD fridge
WEB_APP_HOST 0.0.0.0 127.0.0.1
WEB_APP_PORT 80 8000
RUST_LOG smart_fridge=debug

API

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

Documentation

Build and open the doc in your browser

cargo doc --open

cli healthcheck
cli list
cli add <NAME> [<expiration_date>]
cli get <UUID>
cli delete <UUID>

Dependencies

~46–64MB
~1M SLoC