Adds Health Check API Endpoint
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
from storage_service.config.config_allowed_origins import get_allowed_origins
|
||||
from storage_service.controller.storage_controller import s3_router
|
||||
from storage_service.controller.health_checker_controller import health_router
|
||||
|
||||
from fastapi import FastAPI
|
||||
from fastapi.middleware.cors import CORSMiddleware
|
||||
@@ -16,3 +17,4 @@ app.add_middleware(
|
||||
)
|
||||
|
||||
app.include_router(s3_router)
|
||||
app.include_router(health_router)
|
||||
|
||||
11
storage_service/controller/health_checker_controller.py
Normal file
11
storage_service/controller/health_checker_controller.py
Normal file
@@ -0,0 +1,11 @@
|
||||
from fastapi_utils.cbv import cbv
|
||||
|
||||
from fastapi_utils.inferring_router import InferringRouter
|
||||
|
||||
health_router = InferringRouter()
|
||||
|
||||
@cbv(health_router)
|
||||
class HealthCheckerController:
|
||||
@health_router.get("/health", status_code=200)
|
||||
def health(self) -> dict[str, str]:
|
||||
return {"status": "healthy"}
|
||||
Reference in New Issue
Block a user