112: fix root route r=MarinPostma a=irevoire

closes #93

Co-authored-by: Irevoire <tamo@meilisearch.com>
This commit is contained in:
bors[bot] 2021-03-22 14:08:59 +00:00 committed by GitHub
commit 2ecde74fa4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 1 deletions

View File

@ -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()

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,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()