2025-06-05 22:08:51 +00:00

22 lines
508 B
Python

from fastapi import APIRouter, Depends
from sqlalchemy.orm import Session
from app.api import deps
router = APIRouter()
@router.get("/health")
def health_check(db: Session = Depends(deps.get_db)):
"""
Check the health of the application.
"""
try:
# Try to execute a simple query to check database connection
db.execute("SELECT 1")
db_status = "healthy"
except Exception:
db_status = "unhealthy"
return {"status": "healthy", "database": db_status}