25 lines
558 B
Python
25 lines
558 B
Python
from fastapi import APIRouter, Depends
|
|
from sqlalchemy.orm import Session
|
|
|
|
from app.db.session import get_db
|
|
|
|
router = APIRouter()
|
|
|
|
|
|
@router.get("/", response_model=dict)
|
|
def health_check(db: Session = Depends(get_db)):
|
|
"""
|
|
Health check endpoint.
|
|
Returns the status of the API and its dependencies.
|
|
"""
|
|
try:
|
|
# Check database connection
|
|
db.execute("SELECT 1")
|
|
db_status = "healthy"
|
|
except Exception:
|
|
db_status = "unhealthy"
|
|
|
|
return {
|
|
"status": "healthy",
|
|
"database": db_status,
|
|
} |