Skip to content

Commit

Permalink
Merge pull request #398 from stakwork/health-endpoint
Browse files Browse the repository at this point in the history
feat: health endpoint
  • Loading branch information
Evanfeenstra authored Nov 14, 2024
2 parents 6d221d5 + 4c242ea commit 3ba6e39
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 3ba6e39

Please sign in to comment.