This handler allows you to load remote GraphQL schemas and use it with schema-stitching, based on
To get started, install the handler library from NPM:
Now, you can use it directly in your Mesh config file:
You can check out our example that uses schema stitching with a PostgreSQL datasource. Click here to open the example on GitHub
Mesh can take dynamic values from the GraphQL Context or the environmental variables. If you use
mesh serve, GraphQL Context will be the incoming HTTP request.
The expression inside dynamic values should be as in JS.
From Context (HTTP Header for
mesh serve, you can pass the value using
x-my-graphql-api-token HTTP header.
MY_API_TOKEN is the name of the environmental variable you have the value.
String, required) - A url or file path to your remote GraphQL endpoint. If you provide a path to a code file(js or ts), other options will be ignored and the schema exported from the file will be used directly.
Any) - JSON object representing the Headers to add to the runtime of the API calls only for schema introspection You can also provide
.tsfile path that exports schemaHeaders as an object
JSON) - JSON object representing the Headers to add to the runtime of the API calls only for operation during runtime
Boolean) - Use HTTP GET for Query operations
String (GET | POST)) - HTTP method used for GraphQL operations
Boolean) - Use Server Sent Events instead of WebSocket for Subscriptions
Any) - Path to a custom W3 Compatible Fetch Implementation
String) - Path to a custom W3 Compatible WebSocket Implementation
String) - Path to the introspection You can seperately give schema introspection
Boolean) - Enable multipart/formdata in order to support file uploads
Boolean) - Batch requests