my-favs/backend/app/main.py
RamonCalvo aea7bf5ada feat: add bookmarks CRUD API with FastAPI and Docker Compose
REST API for managing personal bookmarks (title, link, category).
PostgreSQL database with async SQLAlchemy, containerized with Docker Compose.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-28 18:37:23 -06:00

20 lines
509 B
Python

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)