Envelop Plugins
Envelop is a lightweight JavaScript (TypeScript) library for customizing the GraphQL execution layer, allowing developers to build, share and compose plugins that enhance the capabilities of your GraphQL server. GraphQL Yoga uses Envelop under the hood, so you can easily extend your server's capabilities with the plugins from Envelop Ecosystem
Example
The following example adds GraphQL JIT to our GraphQL Server using Envelop GraphQL JIT Plugin:
import { useGraphQlJit } from '@envelop/graphql-jit'
import { createServer } from '@graphql-yoga/node'
// Provide your schema
const server = createServer({
schema: {
typeDefs: /* GraphQL */ `
type Query {
greetings: String!
}
`,
resolvers: {
Query: {
greetings: () => 'Hello World!'
}
}
},
plugins: [useGraphQlJit()]
})
// Start the server and explore http://localhost:4000/graphql
server.start()
Last updated on October 2, 2022