Show current version on server index (#436)
This commit is contained in:
parent
706b1aff65
commit
06ac95876c
1 changed files with 15 additions and 2 deletions
|
@ -6,8 +6,21 @@ use serde::{Deserialize, Serialize};
|
||||||
pub mod history;
|
pub mod history;
|
||||||
pub mod user;
|
pub mod user;
|
||||||
|
|
||||||
pub async fn index() -> &'static str {
|
const VERSION: &str = env!("CARGO_PKG_VERSION");
|
||||||
"\"Through the fathomless deeps of space swims the star turtle Great A\u{2019}Tuin, bearing on its back the four giant elephants who carry on their shoulders the mass of the Discworld.\"\n\t-- Sir Terry Pratchett"
|
|
||||||
|
#[derive(Debug, Serialize, Deserialize)]
|
||||||
|
pub struct IndexResponse {
|
||||||
|
pub homage: String,
|
||||||
|
pub version: String,
|
||||||
|
}
|
||||||
|
|
||||||
|
pub async fn index() -> Json<IndexResponse> {
|
||||||
|
let homage = r#""Through the fathomless deeps of space swims the star turtle Great A'Tuin, bearing on its back the four giant elephants who carry on their shoulders the mass of the Discworld." -- Sir Terry Pratchett"#;
|
||||||
|
|
||||||
|
Json(IndexResponse {
|
||||||
|
homage: homage.to_string(),
|
||||||
|
version: VERSION.to_string(),
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize)]
|
#[derive(Debug, Serialize, Deserialize)]
|
||||||
|
|
Loading…
Reference in a new issue