diff options
| author | Ellie Huxtable <ellie@elliehuxtable.com> | 2022-06-06 09:58:19 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-06-06 09:58:19 +0100 |
| commit | 06ac95876cf1378bc5f3db5ac6c27c564327ea53 (patch) | |
| tree | 60102d99d841205f2aab161dda2b0ade1397edd7 /atuin-server/src/handlers/mod.rs | |
| parent | Disable ARM docker builds (#438) (diff) | |
| download | atuin-06ac95876cf1378bc5f3db5ac6c27c564327ea53.zip | |
Show current version on server index (#436)
Diffstat (limited to 'atuin-server/src/handlers/mod.rs')
| -rw-r--r-- | atuin-server/src/handlers/mod.rs | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/atuin-server/src/handlers/mod.rs b/atuin-server/src/handlers/mod.rs index cfe08bc5..4aa7423e 100644 --- a/atuin-server/src/handlers/mod.rs +++ b/atuin-server/src/handlers/mod.rs @@ -6,8 +6,21 @@ use serde::{Deserialize, Serialize}; pub mod history; pub mod user; -pub async fn index() -> &'static str { - "\"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" +const VERSION: &str = env!("CARGO_PKG_VERSION"); + +#[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)] |
