Remove axum::prelude (#195)

This commit is contained in:
Florian Thelliez
2021-08-18 00:04:15 +02:00
committed by GitHub
parent f083c3e97e
commit d9a06ef14b
43 changed files with 529 additions and 171 deletions
+6 -6
View File
@@ -3,18 +3,18 @@ mod starwars;
use async_graphql::http::{playground_source, GraphQLPlaygroundConfig};
use async_graphql::{EmptyMutation, EmptySubscription, Request, Response, Schema};
use axum::response::IntoResponse;
use axum::{prelude::*, AddExtensionLayer};
use axum::{
extract::Extension, handler::get, response::Html, route, routing::RoutingDsl,
AddExtensionLayer, Json,
};
use starwars::{QueryRoot, StarWars, StarWarsSchema};
async fn graphql_handler(
schema: extract::Extension<StarWarsSchema>,
req: extract::Json<Request>,
) -> response::Json<Response> {
async fn graphql_handler(schema: Extension<StarWarsSchema>, req: Json<Request>) -> Json<Response> {
schema.execute(req.0).await.into()
}
async fn graphql_playground() -> impl IntoResponse {
response::Html(playground_source(GraphQLPlaygroundConfig::new("/")))
Html(playground_source(GraphQLPlaygroundConfig::new("/")))
}
#[tokio::main]