mirror of
https://github.com/meilisearch/MeiliSearch
synced 2024-06-07 13:27:48 +02:00
81255814b1
Co-authored-by: marin <postma.marin@protonmail.com>
57 lines
1.2 KiB
Rust
57 lines
1.2 KiB
Rust
use actix_web::{get, HttpResponse};
|
|
use serde::{Deserialize, Serialize};
|
|
|
|
pub mod document;
|
|
pub mod health;
|
|
pub mod index;
|
|
pub mod key;
|
|
pub mod search;
|
|
pub mod setting;
|
|
pub mod stats;
|
|
pub mod stop_words;
|
|
pub mod synonym;
|
|
pub mod dump;
|
|
|
|
#[derive(Deserialize)]
|
|
pub struct IndexParam {
|
|
index_uid: String,
|
|
}
|
|
|
|
#[derive(Serialize)]
|
|
#[serde(rename_all = "camelCase")]
|
|
pub struct IndexUpdateResponse {
|
|
pub update_id: u64,
|
|
}
|
|
|
|
impl IndexUpdateResponse {
|
|
pub fn with_id(update_id: u64) -> Self {
|
|
Self { update_id }
|
|
}
|
|
}
|
|
|
|
/// Return the dashboard, should not be used in production. See [running]
|
|
#[get("/")]
|
|
pub async fn load_html() -> HttpResponse {
|
|
HttpResponse::Ok()
|
|
.content_type("text/html; charset=utf-8")
|
|
.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()
|
|
.content_type("text/css; charset=utf-8")
|
|
.body(include_str!("../../public/bulma.min.css").to_string())
|
|
}
|