Skip to content

Files

Latest commit

 

History

History
35 lines (28 loc) · 956 Bytes

APIReference-ExpressGraphQL.md

File metadata and controls

35 lines (28 loc) · 956 Bytes
title layout category permalink sublinks next
express-graphql
../_core/GraphQLJSLayout
API Reference
/graphql-js/express-graphql/
graphqlHTTP
/graphql-js/graphql/

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

graphqlHTTP

graphqlHTTP({
  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.