mirror of
https://github.com/tokio-rs/axum.git
synced 2026-08-26 00:00:23 +02:00
Remove axum::prelude (#195)
This commit is contained in:
@@ -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]
|
||||
|
||||
Reference in New Issue
Block a user