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};
|
2020-04-08 14:13:45 +02:00
|
|
|
|
2019-10-31 15:00:36 +01:00
|
|
|
pub mod document;
|
2020-04-07 18:30:38 +02:00
|
|
|
pub mod health;
|
2020-04-08 14:13:45 +02:00
|
|
|
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;
|
2020-04-09 11:11:48 +02:00
|
|
|
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;
|
2020-09-29 12:18:09 +02:00
|
|
|
pub mod dump;
|
2020-04-07 17:47:35 +02:00
|
|
|
|
2020-04-24 15:00:52 +02:00
|
|
|
#[derive(Deserialize)]
|
2020-04-09 11:11:48 +02:00
|
|
|
pub struct IndexParam {
|
2020-04-10 19:05:05 +02:00
|
|
|
index_uid: String,
|
2020-04-09 11:11:48 +02:00
|
|
|
}
|
|
|
|
|
2020-04-24 15:00:52 +02:00
|
|
|
#[derive(Serialize)]
|
2020-04-07 17:47:35 +02:00
|
|
|
#[serde(rename_all = "camelCase")]
|
|
|
|
pub struct IndexUpdateResponse {
|
|
|
|
pub update_id: u64,
|
2020-01-15 17:10:33 +01:00
|
|
|
}
|
|
|
|
|
2020-04-07 17:47:35 +02:00
|
|
|
impl IndexUpdateResponse {
|
|
|
|
pub fn with_id(update_id: u64) -> Self {
|
2020-04-10 19:05:05 +02:00
|
|
|
Self { update_id }
|
2020-04-07 17:47:35 +02:00
|
|
|
}
|
2019-10-31 15:00:36 +01:00
|
|
|
}
|
2020-04-07 17:47:35 +02:00
|
|
|
|
2020-04-07 18:30:38 +02: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())
|
|
|
|
}
|