FastAPI connected to SQLite
This is a simplified FastAPI setup connected to SQLite.
It has a basic register + login flow, and you can list users.
The schema is simple: store email (unique) and password in the sqlite database.
For testing purposes, the password is saved as-is.
POST /register=> create a new user in the database. Body:{"email":"example@mail.com","password":"yourpassword"}POST /login=> check if email+password exists. Body:{"email":"example@mail.com","password":"yourpassword"}GET /users=> returns all users (id+email).
The API has CORS enabled for all origins, so a frontend can call it directly.
The file data.db is a fresh new generated database for the project. If you want to be safe, just delete the file and run the API.
The file will be created automatically.
python -m uvicorn main:app --reload --port 19999Just build your own documentation of this project with pdoc.
python -m pip install pdoc
python -m pdoc app
$env:PYTHONPATH = ".\app"
python -m pdoc ./app
Now, you have a ./doc folder and can enter the index.html locally.
- Use the existing
.docs/index.html - May, It's not an updated version