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 { createYoga, createSchema } from 'graphql-yoga'
// Provide your schema
const yoga = createYoga({
schema: createSchema({
typeDefs: /* GraphQL */ `
type Query {
greetings: String!
}
`,
resolvers: {
Query: {
greetings: () => 'Hello World!'
}
}
}),
plugins: [useGraphQlJit()]
})
// Start the server and explore http://localhost:4000/graphql
const server = createServer(yoga)
server.listen(4000, () => {
console.info('Server is running on http://localhost:4000/graphql')
})
Last updated on November 15, 2022