Update book

This commit is contained in:
Sunli 2020-10-14 08:03:51 +08:00
parent 35ce31ef78
commit 39ba3b4aec
4 changed files with 4 additions and 4 deletions

View File

@ -14,7 +14,7 @@ When you define your `actix_web::App` you need to pass in the Schema as data.
async fn index(
// Schema now accessible here
schema: web::Data<Schema>,
request: Request,
request: async_graphql_actix_web::Request,
) -> web::Json<Response> {
web::Json(Response(schema.execute(request.into_inner()).await)
}

View File

@ -18,7 +18,7 @@ let filter = async_graphql_warp::graphql(schema).and_then(|(schema, request): (M
let resp = schema.execute(request).await;
// Return result
Ok::<_, Infallible>(warp::reply::json(resp).into_response())
Ok::<_, Infallible>(async_graphql_warp::Response::from(resp))
});
warp::serve(filter).run(([0, 0, 0, 0], 8000)).await;
```

View File

@ -11,7 +11,7 @@
```rust
async fn index(
schema: web::Data<Schema>,
request: Request,
request: async_graphql_actix_web::Request,
) -> web::Json<Response> {
web::Json(Response(schema.execute(request.into_inner()).await)
}

View File

@ -17,7 +17,7 @@ let filter = async_graphql_warp::graphql(schema).and_then(|(schema, request): (M
let resp = schema.execute(request).await;
// 返回结果
Ok::<_, Infallible>(warp::reply::json(resp).into_response())
Ok::<_, Infallible>(async_graphql_warp::Response::from(resp))
});
warp::serve(filter).run(([0, 0, 0, 0], 8000)).await;
```