
Features: - Project structure with FastAPI framework - SQLAlchemy models with SQLite database - Alembic migrations system - CRUD operations for items - API routers with endpoints for items - Health endpoint for monitoring - Error handling and validation - Comprehensive documentation
16 lines
431 B
Python
16 lines
431 B
Python
from fastapi import APIRouter, Depends
|
|
from sqlalchemy.orm import Session
|
|
|
|
from app.db.session import get_db
|
|
|
|
router = APIRouter()
|
|
|
|
|
|
@router.get("", status_code=200)
|
|
def health_check(db: Session = Depends(get_db)):
|
|
"""
|
|
Health check endpoint to verify API is running and database connection is working.
|
|
"""
|
|
health_status = {"status": "ok", "database": "connected" if db else "disconnected"}
|
|
return health_status
|