new GQLExpressMiddleware()
A handler that exposes an express middleware function that mounts a
GraphQL I/O endpoint. Typical usage follows:
const app = express();
app.use(/.../, new GQLExpressMiddleware([...classes]).middleware);
- Source:
Classes
Methods
⌾⠀customMiddleware(graphqlHttpOptionsopt, patchFinalOpts) → {function}
If your needs require you to specify different values to graphqlHTTP
,
part of the express-graphql
package, you can use the customMiddleware
function to do so.
The first parameter is an object that should contain valid graphqlHTTP
options. See https://github.com/graphql/express-graphql#options for more
details. Validation is NOT performed.
The second parameter is a function that will be called after any options
have been applied from the first parameter and the rest of the middleware
has been performed. This, if not modified, will be the final options
passed into graphqlHTTP
. In your callback, it is expected that the
supplied object is to be modified and THEN RETURNED. Whatever is returned
will be used or passed on. If nothing is returned, the options supplied
to the function will be used instead.
- Source:
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
graphqlHttpOptions |
Object
|
<optional> |
{graphiql: true} |
standard set of |
patchFinalOpts |
function
|
see above |
Returns:
- Type:
-
function
a middleware function compatible with Express
⬇︎⠀schema() → {string}
Generates the textual schema based on the registered GQLBase
handlers
this instance represents.
- Since:
- 2.7.0
- Source:
Returns:
- Type:
-
string
a generated schema string based on the handlers that
are registered with this GQLExpressMiddleware
instance.