feat: API version endpoint
This commit is contained in:
parent
88aaf3d0d6
commit
c0f0d0521b
3 changed files with 18 additions and 0 deletions
|
|
@ -199,6 +199,7 @@ async fn run_server(db: Arc<DatabaseConnection>, port: u16) {
|
||||||
.routes(routes!(routes::auth::auth))
|
.routes(routes!(routes::auth::auth))
|
||||||
.routes(routes!(routes::auth::check_token))
|
.routes(routes!(routes::auth::check_token))
|
||||||
// Misc
|
// Misc
|
||||||
|
.routes(routes!(routes::misc::current_api_version))
|
||||||
.routes(routes!(routes::websocket::ws_handler))
|
.routes(routes!(routes::websocket::ws_handler))
|
||||||
|
|
||||||
.with_state(shared_state.clone());
|
.with_state(shared_state.clone());
|
||||||
|
|
|
||||||
16
src/routes/misc.rs
Normal file
16
src/routes/misc.rs
Normal file
|
|
@ -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<u64> {
|
||||||
|
Json(1)
|
||||||
|
}
|
||||||
|
|
@ -2,6 +2,7 @@ pub mod auth;
|
||||||
pub mod bal;
|
pub mod bal;
|
||||||
pub mod book;
|
pub mod book;
|
||||||
pub mod book_instance;
|
pub mod book_instance;
|
||||||
|
pub mod misc;
|
||||||
pub mod owner;
|
pub mod owner;
|
||||||
pub mod websocket;
|
pub mod websocket;
|
||||||
|
|
||||||
|
|
|
||||||
Reference in a new issue