Skip to content

Releases: cloudflare/workers-graphql-server

v2.0.1

04 Nov 17:17
Compare
Choose a tag to compare

This is a minor release that removes the outdated GitHub Actions workflow included in this project.

Most developers will want to connect your GitHub repository to Workers and enable automatic deployments using the Git integration.

If you would like to keep using GitHub Actions, see wrangler-action.

v2.0.0

25 Oct 19:06
106fa88
Compare
Choose a tag to compare

The 2.0.0 release of workers-graphql-server modernizes this template, with:

  • Wrangler v2 support
  • Module Workers support
  • Base application rewrite using Hono
  • Example service binding implementation (this is cool, trust me!)
  • Updated implementation of the KV cache

v2.0.0 will be a breaking change as it has been almost entirely rewrittten!

A big shout out to the @as-integrations/cloudflare-workers, which was used as the base layer for this rewrite.

1.2.0

06 Oct 16:17
496f299
Compare
Choose a tag to compare

What's Changed

New Contributors

Full Changelog: 1.1.1...v1.2.0

⚡️ 1.1.0

23 Aug 17:16
36ce340
Compare
Choose a tag to compare

KV cache support

workers-graphql-server now includes support for caching external requests made via instances of RESTDataSource, using KV. To use caching in your project, create a new KV namespace, and in wrangler.toml, configure your namespace, calling it WORKERS_GRAPHQL_CACHE:

# wrangler.toml

[[kv-namespaces]]
binding = "WORKERS_GRAPHQL_CACHE"
id = "$myId"

With a configured KV namespace set up, you can opt-in to KV caching by changing the kvCache config value in graphQLOptions (in index.js) to true.

CORS support for GraphQL requests

The addition of the cors configuration in graphQLOptions (in src/index.js) allows an instance of workers-graphql-server to receive cross-origin requests. By default, the cors option allows cross-origin requests to the server from any origin. You may wish to configure it to whitelist specific origins, methods, or headers. To do this, change the cors option to an object:

const graphQLOptions = {
  // ... other options ...

  cors: {
    allowCredentials: 'true',
    allowHeaders: 'Content-type',
    allowOrigin: '*',
    allowMethods: 'GET, POST, PUT',
  }
}

Note that by default, any field that you don't pass here (e.g. allowMethods) will fallback to the default value. See utils/setCors.js for the default values for these fields.

File layout re-org to follow Apollo tuts

The project layout has been re-organized to follow the structure in Apollo's full-stack tutorial.

🤗 1.0.0

31 Jul 14:59
Compare
Choose a tag to compare

workers-graphql-server is a lightning-fast, globally distributed Apollo GraphQL server, deployed at the edge using Cloudflare Workers.

To get started, check out the tutorial in the Cloudflare Workers docs!