Files
galvanize/src/api/health.rs
lonelyhentxi dd11bc70b5
Some checks failed
CI / Rust Check (push) Has been cancelled
CI / Web UI Check (push) Has been cancelled
CI / Security Audit (push) Has been cancelled
feat: basic
2025-07-12 23:59:42 +08:00

20 lines
553 B
Rust

//! Health check endpoint
//!
//! This module provides the health check API endpoint.
use axum::Json;
use crate::types::HealthResponse;
/// Health check handler
pub async fn health_check() -> Json<HealthResponse> {
static START_TIME: std::sync::OnceLock<std::time::Instant> = std::sync::OnceLock::new();
let start = START_TIME.get_or_init(std::time::Instant::now);
Json(HealthResponse {
status: "ok".to_string(),
version: env!("CARGO_PKG_VERSION").to_string(),
uptime_seconds: start.elapsed().as_secs(),
})
}