use actix_web::{web, HttpResponse};
pub async fn health() -> HttpResponse {
HttpResponse::Ok().json(serde_json::json!({
"status": "ok",
"service": env!("CARGO_PKG_NAME")
}))
}
pub async fn liveness() -> HttpResponse {
HttpResponse::Ok().json(serde_json::json!({
"status": "alive",
"timestamp": chrono::Utc::now().to_rfc3339()
}))
}
pub async fn readiness() -> HttpResponse {
HttpResponse::Ok().json(serde_json::json!({
"status": "ready",
"timestamp": chrono::Utc::now().to_rfc3339()
}))
}
pub fn health_scope() -> actix_web::Scope {
web::scope("/health")
.route("", web::get().to(health))
.route("/live", web::get().to(liveness))
.route("/ready", web::get().to(readiness))
}