MCPcopy Create free account
hub / github.com/SeaQL/sea-orm / graphql_handler

Function graphql_handler

examples/react_admin/backend/src/controllers/graphql.rs:17–28  ·  view source on GitHub ↗
(State(ctx): State<AppContext>, req: Request<Body>)

Source from the content-addressed store, hash-verified

15}
16
17async 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
30pub fn routes() -> Routes {
31 // Define route

Callers

nothing calls this directly

Calls 3

unwrapMethod · 0.80
schemaFunction · 0.50
newFunction · 0.50

Tested by

no test coverage detected