import { createHandler } from "https://deno.land/x/graphql_http@1.0.0-beta.20/handler.ts";
Create HTTP handler what handle GraphQL-over-HTTP request.
Examples
Example 1
Example 1
import { createHandler } from "https://deno.land/x/graphql_http@$VERSION/mod.ts";
import { buildSchema } from "https://esm.sh/graphql@$VERSION";
const schema = buildSchema(`type Query { hello: String! }`);
const handler = createHandler(schema, {
rootValue: {
hello: "world",
},
});
const req = new Request("<ENDPOINT>");
const res = await handler(req);
Parameters
schema: GraphQLSchema
optional
options: HandlerOptions