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