mirror of
https://github.com/tokio-rs/axum.git
synced 2026-08-19 00:00:14 +02:00
Change Router::with_state and impl Service for Router<()> (#1552)
* Implement `Service` for `Router<(), B>` * wip * wip * fix some tests * fix examples * fix doc tests * clean up docs * changelog * fix * also call `with_state` when converting `MethodRouter` into a `MakeService` * suggestions from review
This commit is contained in:
@@ -35,9 +35,7 @@ async fn main() {
|
||||
.with(tracing_subscriber::fmt::layer())
|
||||
.init();
|
||||
|
||||
let router_svc = Router::new()
|
||||
.route("/", get(|| async { "Hello, World!" }))
|
||||
.into_service();
|
||||
let router_svc = Router::new().route("/", get(|| async { "Hello, World!" }));
|
||||
|
||||
let service = tower::service_fn(move |req: Request<Body>| {
|
||||
let router_svc = router_svc.clone();
|
||||
|
||||
Reference in New Issue
Block a user