express-graphql | GraphQL
The express-graphql
module provides a simple way to create an Express server that runs a GraphQL API.
import
{
graphqlHTTP
}
from
"express-graphql"
var
{
graphqlHTTP
}
=
require
(
"express-graphql"
)
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.