Skip to main content


The express-graphql module provides a simple way to create an Express server that runs a GraphQL API.

import { graphqlHTTP } from 'express-graphql'; // ES6
var { graphqlHTTP } = require('express-graphql'); // CommonJS


schema: GraphQLSchema,
graphiql?: ?boolean,
rootValue?: ?any,
context?: ?any,
pretty?: ?boolean,
formatError?: ?Function,
validationRules?: ?Array<any>,
}): Middleware

Constructs an Express application based on a GraphQL schema.

See the express-graphql tutorial for sample usage.

See the GitHub README for more extensive documentation of the details of this method.