14 lines
463 B
Rust
14 lines
463 B
Rust
use super::convert_into_prom_metrics;
|
|
use crate::collectors::stats::get_player_stats;
|
|
use axum::extract::Path;
|
|
use axum::http::StatusCode;
|
|
use axum::response::IntoResponse;
|
|
|
|
pub async fn get_stats(Path(rsn): Path<String>) -> impl IntoResponse {
|
|
let resp = match get_player_stats(&rsn).await {
|
|
Ok(r) => r,
|
|
Err(_) => return (StatusCode::INTERNAL_SERVER_ERROR, "Nope".to_string()),
|
|
};
|
|
|
|
(StatusCode::OK, convert_into_prom_metrics(resp))
|
|
}
|