From dfdd2456a906b177efad17e52fb9fd971764c5c4 Mon Sep 17 00:00:00 2001 From: Sven-Hendrik Haase Date: Fri, 7 Mar 2025 02:15:43 +0100 Subject: Add healthcheck route at /__miniserve_internal/healthcheck Fixes #1435 --- src/main.rs | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/main.rs') diff --git a/src/main.rs b/src/main.rs index ccf611c..688aed1 100644 --- a/src/main.rs +++ b/src/main.rs @@ -219,6 +219,7 @@ async fn run(miniserve_config: MiniserveConfig) -> Result<(), StartupError> { miniserve_config.compress_response, middleware::Compress::default(), )) + .route(&inside_config.healthcheck_route, web::get().to(healthcheck)) .route(&inside_config.favicon_route, web::get().to(favicon)) .route(&inside_config.css_route, web::get().to(css)) .service( @@ -429,6 +430,10 @@ async fn error_404(req: HttpRequest) -> Result { Err(RuntimeError::RouteNotFoundError(req.path().to_string())) } +async fn healthcheck() -> impl Responder { + HttpResponse::Ok().body("OK") +} + async fn favicon() -> impl Responder { let logo = include_str!("../data/logo.svg"); HttpResponse::Ok() -- cgit v1.2.3