from fastapi import FastAPI from fastapi.middleware.cors import CORSMiddleware from app.routers import todos from app.db.session import engine from app.db.base import Base 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) @app.get("/") def read_root(): return { "title": "Todo App API", "description": "A simple Todo application API built with FastAPI", "documentation": "/docs", "health_check": "/health", } @app.get("/health") def health_check(): return {"status": "healthy", "service": "todo-api"}