From 5c918accbc5e20df6ee572edf1a43f141d53b800 Mon Sep 17 00:00:00 2001 From: Gabriel Kaszewski Date: Tue, 12 May 2026 02:05:37 +0200 Subject: [PATCH] feat: add GET /health endpoint for Docker/k8s liveness probes --- crates/presentation/src/routes.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/crates/presentation/src/routes.rs b/crates/presentation/src/routes.rs index 6bf038b..f983ab4 100644 --- a/crates/presentation/src/routes.rs +++ b/crates/presentation/src/routes.rs @@ -18,6 +18,7 @@ pub fn build_router(state: AppState, ap_router: Router) -> Router { let ap_router = ap_router.layer(GovernorLayer::new(ap_cfg)); Router::new() + .route("/health", routing::get(health_handler)) .merge(html_routes(rate_limit)) .merge(api_routes(rate_limit)) .nest_service("/static", ServeDir::new("static")) @@ -26,6 +27,10 @@ pub fn build_router(state: AppState, ap_router: Router) -> Router { .merge(ap_router) } +async fn health_handler() -> axum::Json { + axum::Json(serde_json::json!({ "status": "ok" })) +} + fn per_minute(n: u64) -> Quota { let n = NonZeroU32::new(n.clamp(1, u32::MAX as u64) as u32).unwrap(); Quota::requests_per_minute(n)