MeiliSearch/meilisearch-http/src/routes/mod.rs

45 lines
949 B
Rust
Raw Normal View History

2020-12-12 13:32:06 +01:00
use actix_web::{get, HttpResponse};
use serde::{Deserialize, Serialize};
pub mod document;
pub mod health;
pub mod index;
pub mod key;
pub mod search;
2021-01-01 16:59:49 +01:00
pub mod settings;
2020-12-12 13:32:06 +01:00
pub mod stats;
pub mod stop_words;
pub mod synonym;
2020-12-22 14:02:41 +01:00
//pub mod dump;
2020-12-12 13:32:06 +01:00
#[derive(Deserialize)]
pub struct IndexParam {
2020-12-23 16:12:37 +01:00
index_uid: String,
2020-12-12 13:32:06 +01:00
}
#[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 }
}
}
#[get("/")]
pub async fn load_html() -> HttpResponse {
HttpResponse::Ok()
.content_type("text/html; charset=utf-8")
.body(include_str!("../../public/interface.html").to_string())
}
#[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())
}