Automated Action 3bed1d0510 Create Todo API with FastAPI and SQLite
- Implement Todo CRUD API endpoints
- Set up SQLite database with SQLAlchemy
- Create Todo model and schemas
- Configure Alembic migrations
- Add comprehensive documentation

🤖 Generated with and Co-Authored by [BackendIM](https://backend.im)
2025-05-11 18:30:32 +00:00

31 lines
746 B
Python

from fastapi import FastAPI
from fastapi.middleware.cors import CORSMiddleware
from app.api.routes import router as api_router
from app.core.config import settings
app = FastAPI(
title=settings.PROJECT_NAME,
description="Todo API backend service",
version="0.1.0",
openapi_url=f"{settings.API_V1_STR}/openapi.json",
docs_url="/docs",
redoc_url="/redoc",
)
# Set CORS middleware
app.add_middleware(
CORSMiddleware,
allow_origins=["*"],
allow_credentials=True,
allow_methods=["*"],
allow_headers=["*"],
)
# Include API router
app.include_router(api_router, prefix=settings.API_V1_STR)
if __name__ == "__main__":
import uvicorn
uvicorn.run("main:app", host="0.0.0.0", port=8000, reload=True)