from fastapi import FastAPI from fastapi.middleware.cors import CORSMiddleware from app.api.routes import todos, health from app.db.base import engine from app.models import base base.Base.metadata.create_all(bind=engine) app = FastAPI( title="SimpleTodoAPI", description="A simple ToDo API built with FastAPI and SQLite", version="0.1.0", ) # Add CORS middleware app.add_middleware( CORSMiddleware, allow_origins=["*"], allow_credentials=True, allow_methods=["*"], allow_headers=["*"], ) # Include routers app.include_router(todos.router, prefix="/api", tags=["todos"]) app.include_router(health.router, tags=["health"]) if __name__ == "__main__": import uvicorn uvicorn.run("main:app", host="0.0.0.0", port=8000, reload=True)