torrust-tracker 3.0.0

A feature rich BitTorrent tracker.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
//! API routes for the [`stats`](crate::servers::apis::v1::context::stats) API context.
//!
//! - `GET /stats`
//!
//! Refer to the [API endpoint documentation](crate::servers::apis::v1::context::stats).
use std::sync::Arc;

use axum::routing::get;
use axum::Router;

use super::handlers::get_stats_handler;
use crate::core::Tracker;

/// It adds the routes to the router for the [`stats`](crate::servers::apis::v1::context::stats) API context.
pub fn add(prefix: &str, router: Router, tracker: Arc<Tracker>) -> Router {
    router.route(&format!("{prefix}/stats"), get(get_stats_handler).with_state(tracker))
}