Releases: cloudflare/workers-graphql-server
v2.0.1
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
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
What's Changed
- Update links to Config and Auth docs by @ajcwebdev in #30
- Upgrade to
apollo-server-cloudflare@2.21
and mock 'tls' and 'net' modules. by @abernix in #27 - updates apollo (3.3.0) and graphql (15.6.0) by @timecode in #34
New Contributors
- @ajcwebdev made their first contribution in #30
- @abernix made their first contribution in #27
- @timecode made their first contribution in #34
Full Changelog: 1.1.1...v1.2.0
⚡️ 1.1.0
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.