Lines Matching full:router
53 - **fixed:** Fix panic if `Router` with something nested at `/` was used as a fallback ([#1934])
54 - **added:** Document that `Router::new().fallback(...)` isn't optimal ([#1940])
75 - **fixed:** Fixed performance regression with `Router::nest` introduced in
95 - **fixed:** Don't require `S: Debug` for `impl Debug for Router<S>` ([#1836])
107 - **fixed:** Fix routing issues when loading a `Router` via a dynamic library ([#1806])
139 - **fixed:** Enable passing `MethodRouter` to `Router::fallback` ([#1730])
179 - **added:** Expand the docs for `Router::with_state` ([#1580])
190 let api_router = Router::new()
194 let app = Router::new()
202 The outer router's fallback will still apply if a nested router doesn't have
207 let api_router = Router::new().route("/users", get(|| { ... }));
209 let app = Router::new()
221 use axum::{Router, routing::get, extract::Path};
223 let app = Router::new()
244 use axum::{Router, routing::get, extract::Path};
246 let app = Router::new().route("/foo/*rest", get(handler));
263 use axum::{Router, routing::get};
265 let app = Router::new()
280 use axum::{Router, routing::get};
282 let app = Router::new()
297 - **breaking:** `Router::fallback` now only accepts `Handler`s (similarly to
298 what `get`, `post`, etc. accept). Use the new `Router::fallback_service` for
304 use axum::{Router, handler::Handler};
306 let app = Router::new().fallback(fallback.into_service());
314 use axum::Router;
316 let app = Router::new().fallback(fallback);
323 - **breaking:** It is no longer supported to `nest` a router and add a route at
326 - **changed:** `Router::nest` now only accepts `Router`s, the general-purpose
330 - **breaking:** `Router::route` now only accepts `MethodRouter`s created with
331 `get`, `post`, etc. Use the new `Router::route_service` for routing to
333 - **breaking:** Adding a `.route_layer` onto a `Router` or `MethodRouter`
336 - **breaking:** `RouterService` has been removed since `Router` now implements
337 `Service` when the state is `()`. Use `Router::with_state` to provide the
338 state and get a `Router<()>`. Note that `RouterService` only existed in the
344 `Router::with_state` and gives compile errors for missing states, whereas
348 safe and faster. That is done by using `Router::with_state` and `State`.
353 use axum::{routing::get, Extension, Router};
355 let app = Router::new()
368 use axum::{routing::get, extract::State, Router};
370 let app = Router::new()
384 use axum::{extract::{State, FromRef}, routing::get, Router};
391 let app = Router::new().route("/", get(handler)).with_state(state);
529 - `Router`, defaults to `()`
535 from a middleware applied to a nested router. `MatchedPath` can still be
558 - **added:** Support compiling to WASM. See the `simple-router-wasm` example
561 `MakeService` similarly to `Router::into_make_service` ([#1302])
628 - **breaking:** `Router::with_state` is no longer a constructor. It is instead
629 used to convert the router into a `RouterService` ([#1532])
631 This nested router on 0.6.0-rc.4
634 Router::with_state(state).route(...);
640 Router::new().route(...).with_state(state);
643 - **breaking:**: `Router::inherit_state` has been removed. Use
644 `Router::with_state` instead ([#1532])
645 - **breaking:**: `Router::nest` and `Router::merge` now only supports nesting
646 routers that use the same state type as the router they're being merged into.
676 - **changed:** `Router` no longer implements `Service`, call `.into_service()`
678 - **added:** Add `Router::inherit_state`, which creates a `Router` with an
679 arbitrary state type without actually supplying the state; such a `Router`
681 can be nested or merged into a `Router` with the same state type ([#1368])
682 - **changed:** `Router::nest` now only accepts `Router`s, the general-purpose
684 - **added:** Support compiling to WASM. See the `simple-router-wasm` example
749 - **breaking:** Adding a `.route_layer` onto a `Router` or `MethodRouter`
770 - **breaking:** Nested `Router`s will no longer delegate to the outer `Router`'s
771 fallback. Instead you must explicitly set a fallback on the inner `Router` ([#1086])
773 This nested router on 0.5:
776 use axum::{Router, handler::Handler};
778 let api_routes = Router::new();
780 let app = Router::new()
790 use axum::Router;
792 let api_routes = Router::new()
795 // router's fallback
798 let app = Router::new()
811 use axum::{Router, routing::get, extract::Path};
813 let app = Router::new()
834 use axum::{Router, routing::get, extract::Path};
836 let app = Router::new().route("/foo/*rest", get(handler));
853 use axum::{Router, routing::get};
855 let app = Router::new()
875 use axum::{Router, routing::get};
877 let app = Router::new()
888 - **breaking:** `Router::fallback` now only accepts `Handler`s (similarly to
889 what `get`, `post`, etc accept). Use the new `Router::fallback_service` for
895 use axum::{Router, handler::Handler};
897 let app = Router::new().fallback(fallback.into_service());
905 use axum::Router;
907 let app = Router::new().fallback(fallback);
914 - **breaking:** `Router::route` now only accepts `MethodRouter`s created with
915 `get`, `post`, etc. Use the new `Router::route_service` for routing to
921 `Router::with_state` and gives compile errors for missing states, whereas
925 safe and faster. That is done by using `Router::with_state` and `State`.
930 use axum::{routing::get, Extension, Router};
932 let app = Router::new()
945 use axum::{routing::get, extract::State, Router};
947 let app = Router::with_state(AppState {})
960 use axum::{extract::{State, FromRef}, routing::get, Router};
967 let app = Router::with_state(state).route("/", get(handler));
1098 - `Router`, defaults to `()`
1124 `MakeService` similarly to `Router::into_make_service` ([#1302])
1207 - **fixed:** Make `Router` cheaper to clone ([#1123])
1310 - **changed:** `Router::merge` now accepts `Into<Router>` ([#819])
1357 - **breaking:** `.nest("/foo/", Router::new().route("/bar", _))` now does the right thing and
1375 non-`Router` services) ([#841] and [#842])
1379 - **breaking:** Remove second type parameter from `Router::into_make_service_with_connect_info`
1439 - **fixed:** Fix using incorrect path prefix when nesting `Router`s at `/` ([#691])
1488 - **breaking:** New `MethodRouter` that works similarly to `Router`:
1518 - **breaking:** `Router::merge` will panic if both routers have fallbacks.
1520 - **breaking:** `Router::nest` will panic if the nested router has a fallback.
1561 - **added:** Add `Router::route_layer` for applying middleware that
1578 - **breaking:** The router's type is now always `Router` regardless of how many routes or
1581 This means router types are all always nameable:
1584 fn my_routes() -> Router {
1585 Router::new().route(
1597 public because `Router` is internally boxed ([#404])
1608 `Router`.
1610 handler without a `Router`, and storing info about the incoming connection.
1620 `Router::route` call. So `.route("/", get(get_handler).post(post_handler))` and
1636 - **breaking:** `Router::or` renamed to `Router::merge` and will now panic on
1637 overlapping routes. It now only accepts `Router`s and not general `Service`s.
1638 Use `Router::fallback` for adding fallback routes ([#408])
1639 - **added:** `Router::fallback` for adding handlers for request that didn't
1640 match any routes. `Router::fallback` must be use instead of `nest("/", _)` ([#408])
1642 used in method routers and not in path routers (`Router`)
1652 - **added:** Add `extract::MatchedPath` for accessing path in router that
1656 - All services part of the router are now required to be infallible.
1658 - `Router::check_infallible` has been removed since routers are always
1671 Router, BoxError,
1685 let app = Router::new()
1698 Router, service,
1708 let app = Router::new()
1787 - **fixed:** Remove needless trait bounds from `Router::boxed` ([#269](https://github.com/tokio-rs/…
1801 …- **added:** Add dedicated `Router` to replace the `RoutingDsl` trait ([#214](https://github.com/t…
1802 …- **added:** Add `Router::or` for combining routes ([#108](https://github.com/tokio-rs/axum/pull/1…
1804 together. So `Router::new().route("/", get(...)).route("/", post(...))` now
1808 - **changed:** Replace `axum::route(...)` with `axum::Router::new().route(...)`. This means
1809 there is now only one way to create a new router. Same goes for
1839 Router,
1842 let app = Router::new()
1846 fn api_routes() -> Router<BoxRoute> {
1847 Router::new()
1941 Router,
1945 let app = Router::new().route(
1982 Router,
1985 let app = Router::new().route(
1998 - **changed:** `Router::check_infallible` now returns a `CheckInfallible` service. This
2000 - **changed:** `Router::into_make_service` now returns `routing::IntoMakeService` rather than