from contextlib import asynccontextmanager from fastapi import FastAPI from app.database import engine from app.models import Base from app.routers import bookmarks, categorize, health @asynccontextmanager async def lifespan(app: FastAPI): async with engine.begin() as conn: await conn.run_sync(Base.metadata.create_all) yield app = FastAPI(title="Favs API", lifespan=lifespan) app.include_router(health.router) app.include_router(bookmarks.router) app.include_router(categorize.router)