diff --git a/helpers/healthcheck_helpers.py b/helpers/healthcheck_helpers.py new file mode 100644 index 0000000..778e15e --- /dev/null +++ b/helpers/healthcheck_helpers.py @@ -0,0 +1,48 @@ +from fastapi import APIRouter, status +from datetime import datetime + +router = APIRouter() + +@router.get("/api/health", status_code=status.HTTP_200_OK) +def health_check(): + """ + Health check endpoint to verify service status. + + Returns: + dict: JSON response indicating service is running. + """ + response = { + "status": "ok", + "message": "Service is running", + "timestamp": datetime.utcnow().isoformat() + } + return response + +def is_service_running() -> bool: + """ + Check if the service is running. + + Returns: + bool: True if the service is running, False otherwise. + """ + # Add any necessary checks or logic here + return True + +def get_service_uptime() -> float: + """ + Get the service uptime in seconds. + + Returns: + float: Service uptime in seconds. + """ + # Add logic to calculate service uptime + return 3600.0 # Example: 1 hour uptime + +def get_service_version() -> str: + """ + Get the current service version. + + Returns: + str: Service version string. + """ + return "1.0.0" # Example version \ No newline at end of file