- Install dependencies:
pip install -r requirements.txt
- Run FastAPI server:
uvicorn main:app --reload
- Ensure that everything works, in a new terminal write
curl 127.0.0.1:8000/health
Ensure that you get OK
back.
- Run tests:
pytest .
- Populate database:
python populate.py
Ensure you get products:
curl 127.0.0.1:8000/products
This is the documentation for our FastAPI application. It's a basic app, not too fancy. Does some stuff with products and orders, you know, the usual for books.
To set it up, just run it using some new Python version. You'll figure it out.
We're using SQLite because it's easy and very fast with generating IDs. Just make sure you have a production.db
file somewhere. If it doesn't work, just call me at +46 72 426 20 86, or talk to support.
There are some models or something in Amalone:
Product
: It's got an ID, name, category, and price.OrderDetail
: Connects orders and products, I guess.Order
: It's for orders. It has an ID, timestamp, and total price.
Here are some endpoints, that are very efficient and well written:
/products/
: POST to add a product, GET to get all products. There's also a GET for a single product, but I forgot how it works./order/
: POST to create an order. There's also a GET for all orders and a specific order, but I didn't really test those.
There are test with a lot of coverage, you probably don't have to run it manually too much.
Just install any linter you like on your machine, whatever floats your boat.
- The documentation is up to date
- Everything worked as expected the last time I tested...
- Good luck!