mirror of
https://github.com/cupcakearmy/cryptgeon.git
synced 2025-09-06 01:10:40 +00:00
add healthcheck endpoint and startup check
This commit is contained in:
3
packages/backend/src/health/mod.rs
Normal file
3
packages/backend/src/health/mod.rs
Normal file
@@ -0,0 +1,3 @@
|
||||
mod routes;
|
||||
|
||||
pub use routes::*;
|
16
packages/backend/src/health/routes.rs
Normal file
16
packages/backend/src/health/routes.rs
Normal file
@@ -0,0 +1,16 @@
|
||||
use actix_web::{get, web, HttpResponse, Responder, Scope};
|
||||
|
||||
use crate::store;
|
||||
|
||||
#[get("/")]
|
||||
async fn get_live() -> impl Responder {
|
||||
if store::can_reach_redis() {
|
||||
return HttpResponse::Ok();
|
||||
} else {
|
||||
return HttpResponse::ServiceUnavailable();
|
||||
}
|
||||
}
|
||||
|
||||
pub fn init() -> Scope {
|
||||
web::scope("/live").service(get_live)
|
||||
}
|
Reference in New Issue
Block a user