An example of a FastAPI Server
- How to create sqlite database and how to connect to it
- How to connect to postgresql
- Routing to organize code into files
- How to use alembic
AUTH_ACCESS_TOKEN_KEY
AUTH_REFRESH_TOKEN_KEY
SQLALCHEMY_DB_URL
pip install fastapi
pip install sqlalchemy
pip install "uvicorn[standard]"
pip install "passlib[bcrypt]"
pip install "python-multipart"
pip install "python-jose[cryptography]"
pip install python-dotenv
pip install psycopg2-binary # for postgres
pip install alembic
pip install aiofiles
pip install jinja2
alembic init alembic # to initialize alembic
alembic revision -m '' # to make a migration file with a message
alembic upgrade <revision> # to upgrade db to a specific revision alembic.versions folder
alembic downgrade -1 # to downgrade from the latest migration
from secrets import token_hex
SECRET_KEY=token_hex(32)
Thunder Client (by Ranga Vadhineni)