from fastapi import APIRouter, Depends from sqlalchemy.orm import Session from app.db.database import get_db router = APIRouter() @router.get("/health", summary="Check the health of the application") def health_check(db: Session = Depends(get_db)): """ Check that the application is running and the database is accessible. """ try: # Check if we can access the database db.execute("SELECT 1") return { "status": "ok", "message": "Application is running and database is connected" } except Exception as e: return { "status": "error", "message": f"Application is running but database connection failed: {str(e)}" }