diff --git a/src/axum/app.rs b/src/axum/app.rs index 91e1557..b90df91 100644 --- a/src/axum/app.rs +++ b/src/axum/app.rs @@ -42,6 +42,11 @@ impl AppBuilder { Self::default() } + pub fn route(mut self, route: Router) -> Self { + self.router = self.router.merge(route); + self + } + pub fn routes(mut self, routes: impl IntoIterator) -> Self { self.router = routes.into_iter().fold(self.router, Router::merge); self diff --git a/src/axum/router.rs b/src/axum/router.rs index f557cac..75f7b7e 100644 --- a/src/axum/router.rs +++ b/src/axum/router.rs @@ -21,7 +21,7 @@ #[cfg(feature = "axum")] macro_rules! router { ($body:expr) => { - pub(crate) fn router() -> axum::Router<()> { + pub(crate) fn router() -> axum::Router { $body } }; @@ -104,6 +104,6 @@ mod tests { #[test] fn test_join_routes() { - let _router: Router<()> = join_routes![Router::new(), Router::new()]; + let _router: Router = join_routes![Router::new(), Router::new()]; } }