| 15 | } |
| 16 | |
| 17 | async fn graphql_handler(State(ctx): State<AppContext>, req: Request<Body>) -> Result<Response> { |
| 18 | const DEPTH: usize = 1_000; |
| 19 | const COMPLEXITY: usize = 1_000; |
| 20 | // Construct the the GraphQL query root |
| 21 | let schema = query_root::schema(ctx.db.clone(), DEPTH, COMPLEXITY).unwrap(); |
| 22 | // GraphQL handler |
| 23 | let mut graphql_handler = async_graphql_axum::GraphQL::new(schema); |
| 24 | // Execute GraphQL request and fetch the results |
| 25 | let res = graphql_handler.call(req).await.unwrap(); |
| 26 | |
| 27 | Ok(res) |
| 28 | } |
| 29 | |
| 30 | pub fn routes() -> Routes { |
| 31 | // Define route |