
- Implemented user authentication with JWT tokens - Created comprehensive task management with CRUD operations - Added category system for task organization - Set up SQLite database with SQLAlchemy ORM - Configured Alembic for database migrations - Added API documentation with OpenAPI/Swagger - Implemented proper authorization and user scoping - Created health check and root endpoints - Updated README with complete documentation
46 lines
1.2 KiB
Python
46 lines
1.2 KiB
Python
from fastapi import FastAPI
|
|
from fastapi.middleware.cors import CORSMiddleware
|
|
from app.api import auth, tasks, categories
|
|
from app.db.session import create_tables
|
|
|
|
app = FastAPI(
|
|
title="Personal Task Management API",
|
|
description="A comprehensive API for managing personal tasks, categories, and user authentication",
|
|
version="1.0.0",
|
|
openapi_url="/openapi.json"
|
|
)
|
|
|
|
# CORS middleware
|
|
app.add_middleware(
|
|
CORSMiddleware,
|
|
allow_origins=["*"],
|
|
allow_credentials=True,
|
|
allow_methods=["*"],
|
|
allow_headers=["*"],
|
|
)
|
|
|
|
# Create database tables
|
|
create_tables()
|
|
|
|
# Include routers
|
|
app.include_router(auth.router, prefix="/auth", tags=["authentication"])
|
|
app.include_router(tasks.router, prefix="/tasks", tags=["tasks"])
|
|
app.include_router(categories.router, prefix="/categories", tags=["categories"])
|
|
|
|
@app.get("/")
|
|
def read_root():
|
|
return {
|
|
"title": "Personal Task Management API",
|
|
"description": "A comprehensive API for managing personal tasks and categories",
|
|
"version": "1.0.0",
|
|
"documentation": "/docs",
|
|
"health_check": "/health"
|
|
}
|
|
|
|
@app.get("/health")
|
|
def health_check():
|
|
return {
|
|
"status": "healthy",
|
|
"service": "Personal Task Management API",
|
|
"version": "1.0.0"
|
|
} |