Automated Action d09d61a7c8 Implement Task Manager API with FastAPI and SQLite
- Created FastAPI application structure with main.py and requirements.txt
- Setup SQLite database with SQLAlchemy models for tasks
- Implemented Alembic migrations for database schema management
- Added CRUD endpoints for task management (GET, POST, PUT, DELETE)
- Configured CORS middleware to allow all origins
- Added health endpoint and base route with API information
- Updated README with comprehensive documentation
- Applied code formatting with Ruff linter
2025-06-24 14:17:11 +00:00

38 lines
897 B
Python

from fastapi import FastAPI
from fastapi.middleware.cors import CORSMiddleware
from app.routers import tasks
app = FastAPI(
title="Task Manager API",
description="A simple task management 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=["*"],
)
app.include_router(tasks.router, prefix="/api/v1", tags=["tasks"])
@app.get("/")
def read_root():
return {
"title": "Task Manager API",
"description": "A simple task management API built with FastAPI",
"version": "1.0.0",
"documentation": "/docs",
"health": "/health"
}
@app.get("/health")
def health_check():
return {
"status": "healthy",
"service": "Task Manager API",
"version": "1.0.0"
}