19 lines
557 B
Python
19 lines
557 B
Python
from fastapi import APIRouter, Depends
|
|
from sqlalchemy.orm import Session
|
|
from app.database.config import get_db
|
|
|
|
router = APIRouter()
|
|
|
|
|
|
@router.get("/health")
|
|
def health_check(db: Session = Depends(get_db)):
|
|
"""
|
|
Health check endpoint that verifies the API and database connection are working
|
|
"""
|
|
try:
|
|
# Test database connection
|
|
db.execute("SELECT 1")
|
|
return {"status": "healthy", "database": "connected"}
|
|
except Exception as e:
|
|
return {"status": "unhealthy", "database": "disconnected", "error": str(e)}
|