Implement tower::Layer for Extension (#801)

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

* changelog
This commit is contained in:
David Pedersen
2022-03-01 00:39:22 +01:00
committed by GitHub
parent 0d05b5e31f
commit a2b568c7c1
17 changed files with 51 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");