diff --git a/src/main.rs b/src/main.rs index 7595d37..8f26abf 100644 --- a/src/main.rs +++ b/src/main.rs @@ -199,6 +199,7 @@ async fn run_server(db: Arc, port: u16) { .routes(routes!(routes::auth::auth)) .routes(routes!(routes::auth::check_token)) // Misc + .routes(routes!(routes::misc::current_api_version)) .routes(routes!(routes::websocket::ws_handler)) .with_state(shared_state.clone()); diff --git a/src/routes/misc.rs b/src/routes/misc.rs new file mode 100644 index 0000000..2a26f85 --- /dev/null +++ b/src/routes/misc.rs @@ -0,0 +1,16 @@ +use axum::Json; + +#[axum::debug_handler] +#[utoipa::path( + get, + path = "/version", + responses( + (status = OK, body = u64, description = "Current API version") + ), + summary = "Get the current API version", + tag = "misc", +)] + +pub async fn current_api_version() -> Json { + Json(1) +} diff --git a/src/routes/mod.rs b/src/routes/mod.rs index 5d4b63e..cccb3d0 100644 --- a/src/routes/mod.rs +++ b/src/routes/mod.rs @@ -2,6 +2,7 @@ pub mod auth; pub mod bal; pub mod book; pub mod book_instance; +pub mod misc; pub mod owner; pub mod websocket;