from contextlib import asynccontextmanager from fastapi import FastAPI from app.config import settings from app.database import create_database from app.routers import example_route, project_route @asynccontextmanager async def lifespan(app: FastAPI): create_database() # Stuff that runs once before the app starts :D yield # Stuff that runs when it shuts down :> app = FastAPI( lifespan=lifespan, title=settings.app_name, version=settings.app_version, ) app.include_router(example_route.router) app.include_router(project_route.router)