This is a demo project for building an API using FastAPI https://fastapi.tiangolo.com/
It uses
- Fast API - https://fastapi.tiangolo.com/
- Pydantic - https://pydantic-docs.helpmanual.io/usage/models/
- uvicorn https://github.com/encode/uvicorn
- TinyDB https://github.com/msiemens/tinydb
- Gunicorn https://gunicorn.org/
- Install Python3.11
- Install pdm https://pdm.fming.dev/latest/
- Clone from github
- Build - Install, test, lint
make build
- Tests can be run with
make test
- After build is done run
make app
- Navigate to http://127.0.0.1:8000/docs to view the Open API docs
- todos : http://127.0.0.1:8000/todos => CRUD endpoints agaist In-Memory TinyDB
- books : http://127.0.0.1:8000/books => Get a book's details by ISBN. Uses aiohttp to call OpenAPI
- Based off
python:3.11-slim
. Around 260MB image size docker build -t fastapi/todos .
docker run --name todos-container -p 8000:8000 --rm -d fastapi/todos
gunicorn.conf.py
custom_logging.py
- Working installations of
minikube
andkubectl
- In a terminal
eval $(minikube -p minikube docker-env)
- Build docker image
minikube start
- Switch to
deployments/k8s
kubectl create -f deployments.yaml
kubectl create -f service.yaml
- URL =
minikube service --url fastapi-todos-svc
- Access the swagger console at /docs