Skip to main content

GraphQL Yoga

ResGraph comes with first class support for GraphQL Yoga, a popular and capable GraphQL backend for JavaScript.

The bindings to GraphQL Yoga lives in GraphQLYoga.res.

In general, if you find something is missing when using GraphQL Yoga, feel free to open an issue on the repository. Support GraphQL Yoga is high priority.

Using Envelope plugins

Yoga integrates tightly with Envelope, a plugin system for GraphQL. ResGraph does not ship with bindings to any Envelope plugins by default. It's however trivial to bind to and use plugins yourself if you want. Here's an example of how you can do that:

type useRateLimiterConfig = {
// ... whatever config the plugin has goes here
}

@module("@envelop/rate-limiter")
external useRateLimiter: useRateLimiterConfig => GraphQLYoga.Envelope.plugin = "useRateLimiter"

You then pass it to the plugins option when calling createYoga:

let yoga = createYoga({
schema: ResGraphSchema.schema,
plugins: [
useRateLimiter({
// ... plugin options
})
]
})