INNER CODE UNIT · Rust
index
rkudryashov/graphql-rust-demo · auth-service/src/lib.rs:30
async fn index(
schema: web::Data<AppSchema>,
http_req: HttpRequest,
req: GraphQLRequest,
) -> GraphQLResponse {
let mut query = req.into_inner();
let getting_role_result = common_utils::get_role(http_req);
query = query.data(getting_role_result);
schema.execute(query).await.into()
}
async fn index_playground() -> HttpResponse {
HttpResponse::Ok()
.content_type("text/html; charset=utf-8")
.body(playground_source(GraphQLPlaygroundConfig::new("/")))
}
pub fn create_schema_with_context(pool: PgPool) -> Schema<Query, Mutation, EmptySubscription> {