summaryrefslogtreecommitdiff
path: root/src/graphql/routes.rs
blob: e15267e8a738c47bc221e5a8a96958cda8784436 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
use crate::graphql::mutation::Mutation;
use crate::graphql::query::Query;
use async_graphql::{EmptySubscription, Schema};
use async_graphql_axum::{GraphQLRequest, GraphQLResponse};
use std::sync::Arc;

pub async fn graphql_handler(
    schema: Arc<Schema<Query, Mutation, EmptySubscription>>,
    req: GraphQLRequest,
) -> GraphQLResponse {
    schema.execute(req.into_inner()).await.into()
}