forked from torrust/torrust-tracker
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathroutes.rs
26 lines (23 loc) · 987 Bytes
/
routes.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
//! API routes for the [`stats`](crate::v1::context::stats) API context.
//!
//! - `GET /stats`
//!
//! Refer to the [API endpoint documentation](crate::v1::context::stats).
use std::sync::Arc;
use axum::routing::get;
use axum::Router;
use torrust_tracker_api_core::container::TrackerHttpApiCoreContainer;
use super::handlers::get_stats_handler;
/// It adds the routes to the router for the [`stats`](crate::v1::context::stats) API context.
pub fn add(prefix: &str, router: Router, http_api_container: &Arc<TrackerHttpApiCoreContainer>) -> Router {
router.route(
&format!("{prefix}/stats"),
get(get_stats_handler).with_state((
http_api_container.in_memory_torrent_repository.clone(),
http_api_container.ban_service.clone(),
http_api_container.http_stats_repository.clone(),
http_api_container.udp_core_stats_repository.clone(),
http_api_container.udp_server_stats_repository.clone(),
)),
)
}