Automated Action 3625685e4f Add complete Task Manager API with FastAPI and SQLite
- Created FastAPI application with CRUD operations for tasks
- Implemented SQLAlchemy models with Task entity
- Added Pydantic schemas for request/response validation
- Set up Alembic for database migrations
- Configured SQLite database with proper file structure
- Added health check and root endpoints
- Included comprehensive API documentation
- Applied CORS middleware for development
- Updated README with detailed setup and usage instructions
- Applied code formatting with ruff linter
2025-06-20 23:27:38 +00:00

36 lines
836 B
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
app = FastAPI(
title="Task Manager API",
description="A simple Task Manager API built with FastAPI",
version="1.0.0",
openapi_url="/openapi.json",
)
app.add_middleware(
CORSMiddleware,
allow_origins=["*"],
allow_credentials=True,
allow_methods=["*"],
allow_headers=["*"],
)
Base.metadata.create_all(bind=engine)
app.include_router(tasks_router, prefix="/api/tasks", tags=["tasks"])
@app.get("/")
def root():
return {"title": "Task Manager API", "documentation": "/docs", "health": "/health"}
@app.get("/health")
def health_check():
return {"status": "healthy", "service": "Task Manager API"}