How to use the apollo-server-module-graphiql.resolveGraphiQLString function in apollo-server-module-graphiql

To help you get started, we’ve selected a few apollo-server-module-graphiql examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github alitelabs / tyx / src / core / graphql.ts View on Github external
protected async graphiql(ctx: Context, req: HttpRequest): Promise {
    const options: GraphiQLData = {
      endpointURL: `${this.config.prefix || ''}/graphql`,
      passHeader: ctx.auth.token ? `'Authorization': '${ctx.auth.token}'` : undefined,
      // editorTheme: "idea"
    };
    try {
      return await GraphiQL.resolveGraphiQLString(req.queryStringParameters, options);
    } catch (error) {
      throw new InternalServerError(error.message, error);
    }
  }
github apollographql / apollo-server / packages / apollo-server-azure-functions / src / azureFunctionsApollo.ts View on Github external
const graphiqlHandler = (
    httpContext: HttpContext,
    request: IFunctionRequest,
  ) => {
    const query = request.query;

    resolveGraphiQLString(query, options, httpContext, request).then(
      graphiqlString => {
        const result = {
          status: HttpStatusCodes.OK,
          headers: {
            'Content-Type': 'text/html',
          },
          body: graphiqlString,
          isRaw: true,
        };
        httpContext.res = result;
        httpContext.done(null, result);
      },
      error => {
        httpContext.res = {
          status: 500,
          body: error.message,
github apollographql / apollo-server / packages / apollo-server-adonis / src / adonisApollo.ts View on Github external
const graphiqlHandler = (ctx: AdonisContext): Promise => {
    const { request, response } = ctx;
    const query = request.get();
    return GraphiQL.resolveGraphiQLString(query, options, ctx).then(
      graphiqlString => {
        response.type('text/html').send(graphiqlString);
      },
      (error: HttpQueryError) => {
        response.status(500).send(error.message);
      },
    );
  };
github sysgears / apollo-universal-starter-kit / packages / server / src / middleware / graphiql.ts View on Github external
const graphiqlHandler = (req: express.Request, res: express.Response, next: any) => {
    const query = req.url && url.parse(req.url, true).query;
    GraphiQL.resolveGraphiQLString(query, options, req).then(
      graphiqlString => {
        res.setHeader('Content-Type', 'text/html');
        res.write(graphiqlString);
        res.end();
      },
      error => next(error)
    );
  };
github notadd / next / packages / graphql / servers / graphiql.server.js View on Github external
return (request, response, next) => {
        const query = request.url && url.parse(request.url, true).query;
        GraphiQL.resolveGraphiQLString(query, options, request).then(graphiqlString => {
            response.setHeader("Content-Type", "text/html");
            response.write(graphiqlString);
            response.end();
        }, error => next(error));
    };
}
github elastic / kibana / x-pack / plugins / infra / server / lib / adapters / framework / apollo_server_hapi.ts View on Github external
handler: async (request: Request, h: ResponseToolkit) => {
        const graphiqlString = await GraphiQL.resolveGraphiQLString(
          request.query,
          options.graphiqlOptions,
          request
        );

        return h.response(graphiqlString).type('text/html');
      },
      method: 'GET',
github eggjs / egg-graphql / app / middleware / graphql.js View on Github external
return ctx => {
    const query = ctx.request.query;
    return resolveGraphiQLString(query, options, ctx)
      .then(graphiqlString => {
        ctx.set('Content-Type', 'text/html');
        ctx.body = graphiqlString;
      });
  };
}
github sysgears / create-apollo-app / templates / server / src / server.ts View on Github external
const graphiqlHandler = (req: express.Request, res: express.Response, next: any) => {
    const query = req.url && url.parse(req.url, true).query;
    GraphiQL.resolveGraphiQLString(query, options, req).then(
      (graphiqlString: any) => {
        res.setHeader('Content-Type', 'text/html');
        res.write(graphiqlString);
        res.end();
      },
      (error: any) => next(error)
    );
  };
github huncwotjs / huncwot / graphql.js View on Github external
return async request => {
    let query = request.params;
    let response = await resolveGraphiQLString(query, options, request);

    return HTMLPage(response);
  };
}
github notadd / next / src / graphql / servers / graphiql.server.ts View on Github external
return (request: Partial | any, response: ServerResponse | any, next: any) => {
        const query = request.url && url.parse(request.url, true).query;
        GraphiQL.resolveGraphiQLString(query, options, request).then(
            graphiqlString => {
                response.setHeader("Content-Type", "text/html");
                response.write(graphiqlString);
                response.end();
            },
            error => next(error),
        );
    };
}

apollo-server-module-graphiql

GraphiQL renderer for Apollo GraphQL Server

MIT
Latest version published 6 years ago

Package Health Score

75 / 100
Full package analysis