health.rs 14 lignes · 444 octets
use axum::{http::StatusCode, response::Json};
use serde_json::{Value, json};

/// Health check endpoint handler
///
/// Returns a simple JSON response indicating the server is healthy.
/// This endpoint is used for monitoring and load balancer health checks.
///
/// # Returns
///
/// - `200 OK` with JSON body: `{"status": "ok"}`
pub async fn health_check() -> (StatusCode, Json<Value>) {
    (StatusCode::OK, Json(json!({"status": "ok"})))
}