server: snapshot

This commit is contained in:
nym21
2025-12-15 16:32:45 +01:00
parent 882a3525af
commit 825a4a77c0
100 changed files with 2677 additions and 3438 deletions

View File

@@ -6,6 +6,7 @@ use aide::{
};
use axum::{
Extension, Json,
extract::State,
http::HeaderMap,
response::{Html, Redirect, Response},
routing::get,
@@ -13,7 +14,7 @@ use axum::{
use brk_types::Health;
use crate::{
VERSION,
CacheStrategy, VERSION,
api::{
addresses::AddressRoutes, blocks::BlockRoutes, mempool::MempoolRoutes,
metrics::ApiMetricsRoutes, mining::MiningRoutes, transactions::TxRoutes,
@@ -49,12 +50,15 @@ impl ApiRoutes for ApiRouter<AppState> {
.api_route(
"/version",
get_with(
async || -> Json<&'static str> { Json(VERSION) },
async |headers: HeaderMap, State(state): State<AppState>| {
state.cached_json(&headers, CacheStrategy::Static, |_| Ok(env!("CARGO_PKG_VERSION"))).await
},
|op| {
op.server_tag()
.summary("API version")
.description("Returns the current version of the API server")
.ok_response::<String>()
.not_modified()
},
),
)