Automated Action 8a1b373ff6 feat: Implement Todo API with FastAPI and SQLite
- Setup project structure and dependencies
- Create Todo model and SQLAlchemy database connection
- Set up Alembic for database migrations
- Implement CRUD operations and API endpoints
- Add health check endpoint
- Update README with project documentation

generated with BackendIM... (backend.im)
2025-05-12 10:11:52 +00:00

27 lines
610 B
Python

from fastapi import FastAPI
from fastapi.middleware.cors import CORSMiddleware
from app.routes import todo_router, health_router
from app.database import engine, Base
# Create database tables
Base.metadata.create_all(bind=engine)
app = FastAPI(
title="Todo API",
description="A simple Todo API built with FastAPI",
version="0.1.0"
)
# Configure CORS
app.add_middleware(
CORSMiddleware,
allow_origins=["*"],
allow_credentials=True,
allow_methods=["*"],
allow_headers=["*"],
)
# Include routers
app.include_router(health_router)
app.include_router(todo_router, prefix="/api")