Automated Action 2e537b276d Add Todo API implementation
- Set up project structure with FastAPI, SQLAlchemy, and Alembic
- Create Todo model and database operations
- Implement CRUD API endpoints for Todo items
- Configure database migrations
- Add comprehensive documentation

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-05-11 15:46:42 +00:00

34 lines
814 B
Python

import uvicorn
from fastapi import FastAPI
from fastapi.middleware.cors import CORSMiddleware
from app.api.v1.api import api_router
from app.core.config import settings
from app.db.base import Base, engine
# Create all database tables (if they don't exist)
Base.metadata.create_all(bind=engine)
app = FastAPI(
title=settings.APP_NAME,
openapi_url=f"{settings.API_V1_STR}/openapi.json"
)
# Set all CORS enabled origins
app.add_middleware(
CORSMiddleware,
allow_origins=["*"],
allow_credentials=True,
allow_methods=["*"],
allow_headers=["*"],
)
app.include_router(api_router, prefix=settings.API_V1_STR)
@app.get("/")
def read_root():
return {"message": "Welcome to the Todo API!"}
if __name__ == "__main__":
uvicorn.run("main:app", host="0.0.0.0", port=8000, reload=True)