Skip to content

Commit

Permalink
Add simple healthcheck (#291)
Browse files Browse the repository at this point in the history
  • Loading branch information
paulgb authored Sep 26, 2024
1 parent 010647b commit 245234f
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions crates/y-sweet/src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,7 @@ impl Server {

pub fn routes(self: &Arc<Self>) -> Router {
Router::new()
.route("/ready", get(ready))
.route("/check_store", get(check_store))
.route("/doc/ws/:doc_id", get(handle_socket_upgrade))
.route("/doc/new", post(new_doc))
Expand Down Expand Up @@ -572,6 +573,11 @@ async fn check_store(
Ok(Json(json!({"ok": true})))
}

/// Always returns a 200 OK response, as long as we are listening.
async fn ready() -> Result<Json<Value>, AppError> {
Ok(Json(json!({"ok": true})))
}

async fn new_doc(
authorization: Option<TypedHeader<headers::Authorization<headers::authorization::Bearer>>>,
State(server_state): State<Arc<Server>>,
Expand Down

0 comments on commit 245234f

Please sign in to comment.