Skip to content

Commit

Permalink
feat: health endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
tobi-bams committed Nov 14, 2024
1 parent 6d221d5 commit 4c242ea
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/routes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ pub async fn launch_rocket(
check_challenge,
get_signup_challenge,
check_signup_challenge,
service_health,
],
)
.attach(CORS)
Expand Down Expand Up @@ -147,6 +148,12 @@ pub struct ChallengeStatusResponse {
pub message: String,
}

#[derive(Serialize)]
#[serde(crate = "rocket::serde")]
pub struct ServiceHealthResponse {
pub status: String,
}

#[derive(Serialize)]
#[serde(crate = "rocket::serde")]
pub struct GetChallengeResponse {
Expand Down Expand Up @@ -332,3 +339,11 @@ pub async fn check_signup_challenge(
}
Ok(reply)
}

// /health
#[get("/health")]
pub async fn service_health() -> Result<Json<ServiceHealthResponse>> {
Ok(Json(ServiceHealthResponse {
status: "ok".to_string(),
}))
}

0 comments on commit 4c242ea

Please sign in to comment.