Cloudflare Workers provides a serverless execution environment that allows you to create entirely new applications or augment existing ones without co

Integration with Cloudflare Workers (Yoga)

submited by
Style Pass
2024-05-09 01:30:02

Cloudflare Workers provides a serverless execution environment that allows you to create entirely new applications or augment existing ones without configuring or maintaining infrastructure.

You will want to use the package graphql-yoga which has an agnostic HTTP handler using Fetch API’s Request and Response objects when building GraphQL powered Cloudflare Workers.

For a library enabling topic-based subscriptions using GraphQL Yoga, graphql-ws, see graphql-workers-subscriptions. This library uses Durable Objects and D1 to manage the subscriptions state.

In order to enable Server Sent Events based subscriptions with Cloudflare Workers, make sure you have set the compatibility date in your wrangler configuration file to a date after 2022-11-30 (if that’s not possible, add compatibility flag streams_enable_constructors).

Leave a Comment