from fastapi import FastAPI from fastapi.middleware.cors import CORSMiddleware from app.routes import todos_router from app.db.base import Base from app.db.session import engine Base.metadata.create_all(bind=engine) app = FastAPI( title="Todo App API", description="A simple Todo application API built with FastAPI", version="1.0.0", openapi_url="/openapi.json" ) app.add_middleware( CORSMiddleware, allow_origins=["*"], allow_credentials=True, allow_methods=["*"], allow_headers=["*"], ) app.include_router(todos_router, prefix="/todos", tags=["todos"]) @app.get("/") def root(): return { "title": "Todo App API", "description": "A simple Todo application API built with FastAPI", "documentation": "/docs", "health": "/health" } @app.get("/health") def health_check(): return {"status": "healthy", "service": "todo-app"}