Backport impl tower::Layer for Extension (#805)

* Implement `tower::Layer` for `Extension` (#801)

* Implement `tower::Layer` for `Extension`

* changelog

* Deprecate `AddExtensionLayer`

* changelog

* Add missing #[allow(deprecated)]
This commit is contained in:
David Pedersen
2022-03-01 12:05:42 +01:00
committed by GitHub
parent 5cb6e6d16e
commit ee387ae30b
16 changed files with 67 additions and 43 deletions
+2 -2
View File
@@ -8,7 +8,7 @@ use axum::{
extract::Extension,
response::{Html, IntoResponse},
routing::get,
AddExtensionLayer, Json, Router,
Json, Router,
};
use starwars::{QueryRoot, StarWars, StarWarsSchema};
@@ -28,7 +28,7 @@ async fn main() {
let app = Router::new()
.route("/", get(graphql_playground).post(graphql_handler))
.layer(AddExtensionLayer::new(schema));
.layer(Extension(schema));
println!("Playground: http://localhost:3000");