diff --git a/meilisearch-http/src/lib.rs b/meilisearch-http/src/lib.rs index cdd874a35..9532273aa 100644 --- a/meilisearch-http/src/lib.rs +++ b/meilisearch-http/src/lib.rs @@ -44,7 +44,7 @@ macro_rules! create_app { let app = if $enable_frontend { app.service(load_html).service(load_css) } else { - app + app.service(running) }; app.wrap( Cors::default() diff --git a/meilisearch-http/src/routes/mod.rs b/meilisearch-http/src/routes/mod.rs index e1345fa08..9164f2d2f 100644 --- a/meilisearch-http/src/routes/mod.rs +++ b/meilisearch-http/src/routes/mod.rs @@ -29,6 +29,7 @@ impl IndexUpdateResponse { } } +/// Return the dashboard, should not be used in production. See [running] #[get("/")] pub async fn load_html() -> HttpResponse { HttpResponse::Ok() @@ -36,6 +37,17 @@ pub async fn load_html() -> HttpResponse { .body(include_str!("../../public/interface.html").to_string()) } +/// Always return a 200 with: +/// ```json +/// { +/// "status": "Meilisearch is running" +/// } +/// ``` +#[get("/")] +pub async fn running() -> HttpResponse { + HttpResponse::Ok().json(serde_json::json!({ "status": "MeiliSearch is running" })) +} + #[get("/bulma.min.css")] pub async fn load_css() -> HttpResponse { HttpResponse::Ok()