Skip to main content

doido_controller/
health.rs

1//! Health-check endpoint (Rails 8 `GET /up`): returns 200 when the app boots.
2
3use axum::body::Body;
4use axum::response::Response;
5use axum::routing::get;
6use axum::Router;
7use http::StatusCode;
8
9/// The `/up` handler: a plain `200 OK`.
10pub async fn up() -> Response {
11    Response::builder()
12        .status(StatusCode::OK)
13        .body(Body::from("OK"))
14        .expect("valid health response")
15}
16
17/// Add the `GET /up` health route to a router.
18pub fn with_health(router: Router) -> Router {
19    router.route("/up", get(up))
20}