add match page

This commit is contained in:
Robin Appelman 2023-11-19 00:16:50 +01:00
commit 668edc434a
9 changed files with 3614 additions and 7 deletions

View file

@ -64,6 +64,7 @@ async fn main() -> MainResult {
.route("/team/:id", get(team))
.route("/team/:id/roster", get(team_roster))
.route("/team/:id/matches", get(team_matches))
.route("/match/:id", get(match_page))
.with_state(AppState::default());
// run it
@ -150,3 +151,13 @@ async fn team_matches(
let response = state.client.team_matches(id).await?;
Ok(Json(response))
}
#[instrument(skip(state))]
async fn match_page(
Path(id): Path<u32>,
State(state): State<AppState>,
) -> Result<impl IntoResponse, ApiError> {
debug!(team = id, "requesting match");
let response = state.client.match_info(id).await?;
Ok(Json(response))
}