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

45 lines
946 B
Rust
Raw Normal View History

2020-04-09 10:39:34 +02:00
use actix_web::{get, HttpResponse};
2020-04-10 19:05:05 +02:00
use serde::{Deserialize, Serialize};
2019-10-31 15:00:36 +01:00
pub mod document;
pub mod health;
pub mod index;
2020-04-07 19:10:32 +02:00
pub mod key;
2020-04-07 19:34:57 +02:00
pub mod search;
pub mod setting;
2020-04-10 19:05:05 +02:00
pub mod stats;
2020-04-10 18:39:52 +02:00
pub mod stop_words;
pub mod synonym;
pub mod dump;
2020-04-24 15:00:52 +02:00
#[derive(Deserialize)]
pub struct IndexParam {
2020-04-10 19:05:05 +02:00
index_uid: String,
}
2020-04-24 15:00:52 +02:00
#[derive(Serialize)]
#[serde(rename_all = "camelCase")]
pub struct IndexUpdateResponse {
pub update_id: u64,
2020-01-15 17:10:33 +01:00
}
impl IndexUpdateResponse {
pub fn with_id(update_id: u64) -> Self {
2020-04-10 19:05:05 +02:00
Self { update_id }
}
2019-10-31 15:00:36 +01:00
}
#[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())
}