Skip to content

Instantly share code, notes, and snippets.

@chris-feist
Created March 3, 2020 19:28
Show Gist options
  • Save chris-feist/b1c9405c1384443f9e329c37ffe5a0d6 to your computer and use it in GitHub Desktop.
Save chris-feist/b1c9405c1384443f9e329c37ffe5a0d6 to your computer and use it in GitHub Desktop.
GraphQL Handler for production GraphQL server example
import { ApolloServer } from 'apollo-server-lambda';
import schema from './schema';
const ENABLE_INTROSPECTION = process.env.STAGE !== 'prod';
const server = new ApolloServer({
schema,
playground: ENABLE_INTROSPECTION,
introspection: ENABLE_INTROSPECTION,
});
export const graphQlHandler = server.createHandler({
cors: {
origin: '*',
credentials: true,
},
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment