How to use the apollo-server-express/dist/expressApollo.graphqlExpress function in apollo-server-express

To help you get started, we’ve selected a few apollo-server-express 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 terascope / teraslice / packages / data-access-plugin / src / query-point / dynamic-server.ts View on Github external
// @ts-ignore
                        req.aclManager,
                        user,
                        this.logger,
                        this.pluginContext,
                        this.concurrency
                    );

                    /**
                     * This is the main reason to extend, to access graphqlExpress(),
                     * to be able to modify the schema based on the request
                     * It binds to our new object, since the parent accesses the schema
                     * from this.schema etc.
                     */

                    return graphqlExpress(
                        // @ts-ignore
                        super.createGraphQLServerOptions.bind({
                            ...serverObj,
                            graphqlPath: path,
                            /* Retrieves a custom graphql schema based on request */
                            schema: roleSchema,
                            formatError,
                            introspection: !!user.role,
                            plugins: [
                                makeComplexityPlugin(
                                    this.logger,
                                    this.complexitySize,
                                    roleSchema,
                                    user.id
                                )
                            ],
github terascope / teraslice / packages / data-access-plugin / src / dynamic-server / index.ts View on Github external
res.end();
                    return;
                }
            }

            /* Not necessary, but removing to ensure schema built on the request */
            // tslint:disable-next-line
            const { schema, ...serverObj } = this;

            /**
             * This is the main reason to extend, to access graphqlExpress(),
             * to be able to modify the schema based on the request
             * It binds to our new object, since the parent accesses the schema
             * from this.schema etc.
             */
            return graphqlExpress(
                // @ts-ignore
                super.createGraphQLServerOptions.bind({
                    ...serverObj,
                    graphqlPath: path,
                    /* Retrieves a custom graphql schema based on request */
                    schema: makeExecutableSchema({
                        typeDefs,
                        resolvers,
                        inheritResolversFromInterfaces: true,
                    }),
                    formatError: utils.formatError,
                    playground: {
                        settings: {
                            'request.credentials': 'include',
                        }
                    } as apollo.PlaygroundConfig
github parse-community / parse-server / src / GraphQL / ParseGraphQLServer.js View on Github external
app.use(
      this.config.graphQLPath,
      graphqlUploadExpress({
        maxFileSize: this._transformMaxUploadSizeToBytes(
          this.parseServer.config.maxUploadSize || '20mb'
        ),
      })
    );
    app.use(this.config.graphQLPath, corsMiddleware());
    app.use(this.config.graphQLPath, bodyParser.json());
    app.use(this.config.graphQLPath, handleParseHeaders);
    app.use(this.config.graphQLPath, handleParseErrors);
    app.use(
      this.config.graphQLPath,
      graphqlExpress(async req => await this._getGraphQLOptions(req))
    );
  }