Automated Action 0d6888d900 Add Task Manager API with FastAPI and SQLite
- Created comprehensive task management system with CRUD operations
- Implemented SQLAlchemy models and database configuration
- Added Alembic migrations for database schema management
- Created FastAPI endpoints for task management with proper validation
- Added health check endpoint and base URL information
- Configured CORS middleware and OpenAPI documentation
- Updated README with comprehensive API documentation
- Code formatted and linted with Ruff
2025-07-07 20:49:13 +00:00

43 lines
1.0 KiB
Python

from fastapi import FastAPI
from fastapi.middleware.cors import CORSMiddleware
from app.api.tasks import router as tasks_router
from app.db.session import engine
from app.db.base import Base
Base.metadata.create_all(bind=engine)
app = FastAPI(
title="Task Manager API",
description="A simple task management API built with FastAPI",
version="1.0.0",
openapi_url="/openapi.json",
docs_url="/docs",
redoc_url="/redoc",
)
app.add_middleware(
CORSMiddleware,
allow_origins=["*"],
allow_credentials=True,
allow_methods=["*"],
allow_headers=["*"],
)
app.include_router(tasks_router, prefix="/api/v1")
@app.get("/")
async def root():
return {
"title": "Task Manager API",
"description": "A simple task management API built with FastAPI",
"version": "1.0.0",
"documentation": "/docs",
"health_check": "/health",
}
@app.get("/health")
async def health_check():
return {"status": "healthy", "service": "Task Manager API", "version": "1.0.0"}