Skip to content
This repository has been archived by the owner on Jan 21, 2024. It is now read-only.

Commit

Permalink
add health endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
luizirber committed Nov 2, 2023
1 parent 7ea55b8 commit afdec80
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion crates/server/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use axum::{
extract::{ContentLengthLimit, Extension},
http::{header, StatusCode},
response::{IntoResponse, Response},
routing::{get_service, post},
routing::{get, get_service, post},
Router,
};
use sentry::integrations::tower::{NewSentryLayer, SentryHttpLayer};
Expand Down Expand Up @@ -100,6 +100,7 @@ async fn main() {
// Build our application by composing routes
let app = Router::new()
.route("/search", post(search))
.route("/health", get(health))
//.route("/gather", post(gather))
.fallback(get_service(ServeDir::new(opts.assets)).handle_error(handle_static_serve_error))
// Add middleware to all routes
Expand Down Expand Up @@ -213,6 +214,10 @@ async fn search(
}
}

async fn health() -> Response<BoxBody> {
(StatusCode::OK, "I'm doing science and I'm still alive").into_response()
}

async fn handle_static_serve_error(error: std::io::Error) -> impl IntoResponse {
(
StatusCode::INTERNAL_SERVER_ERROR,
Expand Down

0 comments on commit afdec80

Please sign in to comment.