mirror of
https://github.com/actix/examples
synced 2025-06-26 17:17:42 +02:00
fmt
This commit is contained in:
@ -12,10 +12,7 @@ use self::star_wars::{QueryRoot, StarWars, StarWarsSchema};
|
||||
|
||||
/// GraphQL endpoint
|
||||
#[route("/graphql", method = "GET", method = "POST")]
|
||||
async fn graphql(
|
||||
schema: web::Data<StarWarsSchema>,
|
||||
req: GraphQLRequest,
|
||||
) -> GraphQLResponse {
|
||||
async fn graphql(schema: web::Data<StarWarsSchema>, req: GraphQLRequest) -> GraphQLResponse {
|
||||
schema.execute(req.into_inner()).await.into()
|
||||
}
|
||||
|
||||
|
@ -25,10 +25,7 @@ async fn graphql_playground() -> impl Responder {
|
||||
|
||||
/// GraphQL endpoint
|
||||
#[route("/graphql", method = "GET", method = "POST")]
|
||||
async fn graphql(
|
||||
st: web::Data<Schema>,
|
||||
data: web::Json<GraphQLRequest>,
|
||||
) -> impl Responder {
|
||||
async fn graphql(st: web::Data<Schema>, data: web::Json<GraphQLRequest>) -> impl Responder {
|
||||
let user = data.execute(&st, &()).await;
|
||||
HttpResponse::Ok().json(user)
|
||||
}
|
||||
|
Reference in New Issue
Block a user