INNER CODE UNIT · TypeScript

graphqlHTTP

graphql-community/koa-graphql · src/index.ts:155

export function graphqlHTTP(options: Options): Middleware {
  devAssertIsNonNullable(options, 'GraphQL middleware requires options.');

  return async function middleware(ctx): Promise<void> {
    const req = ctx.req;
    const request = ctx.request;
    const response = ctx.response;

    // Higher scoped variables are referred to at various stages in the
    // asynchronous state machine below.
    let params: GraphQLParams | undefined;
    let showGraphiQL = false;
    let graphiqlOptions: GraphiQLOptions | undefined;
    let formatErrorFn = formatError;
    let pretty = false;
    let result: ExecutionResult;

    try {

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…