add state to router

Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
Jason Volk 2024-07-15 03:56:27 +00:00
parent 720fbd09c2
commit 038b71fc9d
4 changed files with 19 additions and 18 deletions

View file

@ -9,15 +9,16 @@ use axum::{
routing::{any, get, post},
Router,
};
use conduit::{err, Error, Server};
use conduit::{err, Server};
use http::Uri;
use ruma::api::client::error::ErrorKind;
use self::handler::RouterExt;
pub(super) use self::{ar::Ruma, response::RumaResponse};
pub(super) use self::{args::Args as Ruma, response::RumaResponse};
use crate::{client, server};
pub fn build(router: Router, server: &Server) -> Router {
pub type State = &'static service::Services;
pub fn build(router: Router<State>, server: &Server) -> Router<State> {
let config = &server.config;
let router = router
.ruma_route(client::get_supported_versions_route)