31 lines
729 B
Rust
31 lines
729 B
Rust
|
|
// Health check endpoint
|
||
|
|
|
||
|
|
use axum::{http::StatusCode, response::IntoResponse, Json};
|
||
|
|
use serde_json::json;
|
||
|
|
|
||
|
|
/// Health check endpoint
|
||
|
|
///
|
||
|
|
/// Returns current server status and version information
|
||
|
|
pub async fn health() -> impl IntoResponse {
|
||
|
|
(
|
||
|
|
StatusCode::OK,
|
||
|
|
Json(json!({
|
||
|
|
"status": "healthy",
|
||
|
|
"service": "vapora-backend",
|
||
|
|
"version": env!("CARGO_PKG_VERSION"),
|
||
|
|
"timestamp": chrono::Utc::now().to_rfc3339(),
|
||
|
|
})),
|
||
|
|
)
|
||
|
|
}
|
||
|
|
|
||
|
|
#[cfg(test)]
|
||
|
|
mod tests {
|
||
|
|
use super::*;
|
||
|
|
|
||
|
|
#[tokio::test]
|
||
|
|
async fn test_health_endpoint() {
|
||
|
|
let response = health().await;
|
||
|
|
// Response type verification - actual testing will be in integration tests
|
||
|
|
}
|
||
|
|
}
|