from fastapi import APIRouter, Depends from sqlalchemy.orm import Session from app.db.deps import get_db router = APIRouter() @router.get("/") def health_check(db: Session = Depends(get_db)): """ Health check endpoint to verify API is up and running and can connect to the database. """ try: # Execute a simple query to check database connection db.execute("SELECT 1") return {"status": "ok", "message": "API is healthy"} except Exception as e: return {"status": "error", "message": f"API health check failed: {str(e)}"}