From 3c696cfc9005e73be5ed46f8941dfc8f0aca7102 Mon Sep 17 00:00:00 2001 From: soryu Date: Sun, 21 Dec 2025 01:27:02 +0000 Subject: Create container image and move parakeet fork to vendor dir --- makima/src/server/mod.rs | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) (limited to 'makima/src/server/mod.rs') diff --git a/makima/src/server/mod.rs b/makima/src/server/mod.rs index a6e0525..c509afa 100644 --- a/makima/src/server/mod.rs +++ b/makima/src/server/mod.rs @@ -6,9 +6,12 @@ pub mod openapi; pub mod state; use axum::{ + http::StatusCode, + response::IntoResponse, routing::get, - Router, + Json, Router, }; +use serde::Serialize; use tower_http::cors::{Any, CorsLayer}; use tower_http::trace::TraceLayer; use utoipa::OpenApi; @@ -18,6 +21,23 @@ use crate::server::handlers::listen; use crate::server::openapi::ApiDoc; use crate::server::state::SharedState; +#[derive(Serialize)] +struct HealthResponse { + status: &'static str, + version: &'static str, +} + +/// Health check endpoint for load balancers and orchestrators. +async fn health_check() -> impl IntoResponse { + ( + StatusCode::OK, + Json(HealthResponse { + status: "healthy", + version: env!("CARGO_PKG_VERSION"), + }), + ) +} + /// Create the axum Router with all routes configured. pub fn make_router(state: SharedState) -> Router { // API v1 routes @@ -29,6 +49,7 @@ pub fn make_router(state: SharedState) -> Router { .url("/api-docs/openapi.json", ApiDoc::openapi()); Router::new() + .route("/api/v1/healthcheck", get(health_check)) .nest("/api/v1", api_v1) .merge(swagger) .layer( -- cgit v1.2.3