kegani 0.1.1

A developer-friendly, ergonomic, production-ready Rust web framework
Documentation
//! Health check probes
//!
//! Implements liveness and readiness endpoints.

use actix_web::{HttpResponse, Responder};

/// Liveness handler
pub async fn liveness_handler() -> impl Responder {
    HttpResponse::Ok().json(serde_json::json!({
        "status": "alive",
        "timestamp": chrono::Utc::now().to_rfc3339()
    }))
}

/// Readiness handler
pub async fn readiness_handler() -> impl Responder {
    HttpResponse::Ok().json(serde_json::json!({
        "status": "ready",
        "timestamp": chrono::Utc::now().to_rfc3339()
    }))
}

/// Health check trait for implementors
pub trait HealthCheck: Send + Sync {
    /// Check if the component is healthy
    fn check(&self) -> std::pin::Pin<Box<dyn std::future::Future<Output = bool> + Send + '_>>;
}