mirror of
https://github.com/tokio-rs/axum.git
synced 2026-08-23 00:00:15 +02:00
Implement tower::Layer for Extension (#801)
* Implement `tower::Layer` for `Extension` * changelog
This commit is contained in:
@@ -18,7 +18,7 @@ use axum::{
|
||||
http::{header::SET_COOKIE, HeaderMap},
|
||||
response::{IntoResponse, Redirect, Response},
|
||||
routing::get,
|
||||
AddExtensionLayer, Router,
|
||||
Router,
|
||||
};
|
||||
use http::header;
|
||||
use oauth2::{
|
||||
@@ -49,8 +49,8 @@ async fn main() {
|
||||
.route("/auth/authorized", get(login_authorized))
|
||||
.route("/protected", get(protected))
|
||||
.route("/logout", get(logout))
|
||||
.layer(AddExtensionLayer::new(store))
|
||||
.layer(AddExtensionLayer::new(oauth_client));
|
||||
.layer(Extension(store))
|
||||
.layer(Extension(oauth_client));
|
||||
|
||||
let addr = SocketAddr::from(([127, 0, 0, 1], 3000));
|
||||
tracing::debug!("listening on {}", addr);
|
||||
|
||||
Reference in New Issue
Block a user