
- Add complete CRUD operations for task management - Implement task filtering by status, priority, and search - Add task statistics endpoint for summary data - Configure SQLite database with Alembic migrations - Set up FastAPI with CORS support and API documentation - Include health check endpoint and base URL information - Add comprehensive README with API usage examples - Structure project with proper separation of concerns
46 lines
1.0 KiB
Python
46 lines
1.0 KiB
Python
from fastapi import FastAPI
|
|
from fastapi.middleware.cors import CORSMiddleware
|
|
from app.api import tasks
|
|
from app.db.session import engine
|
|
from app.db.base import Base
|
|
|
|
app = FastAPI(
|
|
title="Task Manager API",
|
|
description="A comprehensive Task Manager 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=["*"],
|
|
)
|
|
|
|
Base.metadata.create_all(bind=engine)
|
|
|
|
app.include_router(tasks.router, prefix="/tasks", tags=["tasks"])
|
|
|
|
|
|
@app.get("/")
|
|
def read_root():
|
|
return {
|
|
"title": "Task Manager API",
|
|
"description": "A comprehensive Task Manager API built with FastAPI",
|
|
"version": "1.0.0",
|
|
"documentation": "/docs",
|
|
"health_check": "/health"
|
|
}
|
|
|
|
|
|
@app.get("/health")
|
|
def health_check():
|
|
return {
|
|
"status": "healthy",
|
|
"service": "Task Manager API",
|
|
"version": "1.0.0"
|
|
} |