mirror of
https://github.com/tokio-rs/axum.git
synced 2026-08-24 00:00:16 +02:00
Implement tower::Layer for Extension (#801)
* Implement `tower::Layer` for `Extension` * changelog
This commit is contained in:
@@ -29,7 +29,7 @@ use std::{
|
||||
time::Duration,
|
||||
};
|
||||
use tower::{BoxError, ServiceBuilder};
|
||||
use tower_http::{add_extension::AddExtensionLayer, trace::TraceLayer};
|
||||
use tower_http::trace::TraceLayer;
|
||||
use uuid::Uuid;
|
||||
|
||||
#[tokio::main]
|
||||
@@ -61,7 +61,7 @@ async fn main() {
|
||||
}))
|
||||
.timeout(Duration::from_secs(10))
|
||||
.layer(TraceLayer::new_for_http())
|
||||
.layer(AddExtensionLayer::new(db))
|
||||
.layer(Extension(db))
|
||||
.into_inner(),
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user