20 lines
553 B
Rust
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(),
|
|
})
|
|
}
|