mirror of
https://github.com/tokio-rs/axum.git
synced 2026-08-27 00:00:24 +02:00
Use tuples instead of ServiceBuilder internally (#2229)
This commit is contained in:
@@ -14,7 +14,6 @@ use axum::{
|
||||
routing::post,
|
||||
Router,
|
||||
};
|
||||
use tower::ServiceBuilder;
|
||||
use tracing_subscriber::{layer::SubscriberExt, util::SubscriberInitExt};
|
||||
|
||||
#[tokio::main]
|
||||
@@ -29,7 +28,7 @@ async fn main() {
|
||||
|
||||
let app = Router::new()
|
||||
.route("/", post(handler))
|
||||
.layer(ServiceBuilder::new().layer(middleware::from_fn(print_request_body)));
|
||||
.layer(middleware::from_fn(print_request_body));
|
||||
|
||||
let listener = tokio::net::TcpListener::bind("127.0.0.1:3000")
|
||||
.await
|
||||
|
||||
Reference in New Issue
Block a user