diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib.rs | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/src/lib.rs b/src/lib.rs index d5bbaec..230b878 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,11 +1,35 @@ -use axum::{routing::get, Router}; +use axum::{routing::get, Json, Router}; +use serde::Serialize; /// Build the application router. Public so integration tests (tests/) and /// the binary (src/main.rs) can both use it without binding a real socket. pub fn app() -> Router { - Router::new().route("/", get(hello_world)) + Router::new() + .route("/", get(hello_world)) + .route("/version", get(version)) } async fn hello_world() -> &'static str { "Hello, world!" } + +#[derive(Serialize)] +struct VersionInfo { + name: &'static str, + short_name: &'static str, + version: f64, + release: u32, + date: &'static str, + git: &'static str, +} + +async fn version() -> Json<VersionInfo> { + Json(VersionInfo { + name: "GeneNetwork4", + short_name: "GN4AI", + version: 4.0, + release: 1, + date: env!("GN4_COMMIT_DATE"), + git: env!("GN4_GIT_HASH"), + }) +} |
