Skip to content

Instantly share code, notes, and snippets.

@modster
Created November 16, 2021 07:13
Show Gist options
  • Save modster/ce7653d5d714f867ef2a989d296766f9 to your computer and use it in GitHub Desktop.
Save modster/ce7653d5d714f867ef2a989d296766f9 to your computer and use it in GitHub Desktop.
Define a simple API with express-graphql
// https://graphql.org/graphql-js/express-graphql/#graphqlhttp
// import { graphqlHTTP } from 'express-graphql'; // ES6
var { graphqlHTTP } = require('express-graphql'); // CommonJS
graphqlHTTP({
schema: GraphQLSchema,
graphiql?: ?boolean,
rootValue?: ?any,
context?: ?any,
pretty?: ?boolean,
formatError?: ?Function,
validationRules?: ?Array<any>,
}): Middleware
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment