return a 400 on / when meilisearch is running in production

This commit is contained in:
tamo 2021-03-16 13:38:43 +01:00
parent 5ca3382f5c
commit 0c27bea135
No known key found for this signature in database
GPG Key ID: 7A6A970C96104F1B
2 changed files with 14 additions and 0 deletions

View File

@ -63,6 +63,7 @@ pub fn create_app(
.service(routes::load_css)
} else {
app
.service(routes::running)
}
}

View File

@ -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,18 @@ 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 {
let payload = serde_json::json!({ "status": "MeiliSearch is running" }).to_string();
HttpResponse::Ok().body(payload)
}
#[get("/bulma.min.css")]
pub async fn load_css() -> HttpResponse {
HttpResponse::Ok()