feat: basic
This commit is contained in:
19
src/api/health.rs
Normal file
19
src/api/health.rs
Normal file
@@ -0,0 +1,19 @@
|
||||
//! 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(),
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user