mirror of
https://github.com/bitcoinresearchkit/brk.git
synced 2026-06-14 00:33:36 -07:00
21 lines
488 B
Rust
21 lines
488 B
Rust
use axum::{routing::get, Router};
|
|
use handlers::{dataset_handler, last_values_handler};
|
|
|
|
use super::AppState;
|
|
|
|
mod handlers;
|
|
pub mod structs;
|
|
|
|
pub const API_URL_PREFIX: &str = "/api";
|
|
|
|
pub trait ApiRoutes {
|
|
fn add_api_routes(self) -> Self;
|
|
}
|
|
|
|
impl ApiRoutes for Router<AppState> {
|
|
fn add_api_routes(self) -> Self {
|
|
self.route(&format!("{API_URL_PREFIX}/last"), get(last_values_handler))
|
|
.route(&format!("{API_URL_PREFIX}/*path"), get(dataset_handler))
|
|
}
|
|
}
|