Skip to content
This repository was archived by the owner on Feb 9, 2023. It is now read-only.

v2.0.0

Choose a tag to compare

@kimyvgy kimyvgy released this 20 Dec 03:39
· 3 commits to main since this release

FEATURES

  • startServerAndCreateCloudflareHandler will return an request handler (GraphQLRequestHandler) instead of the Response

BREAKING CHANGE:

Before:

  const response = startServerAndCreateCloudflareHandler(server, {
    cors: { // cors configuration },
    context: async () => {
      const cache = options.kvCache ? new KVCache() : server.cache;

      const dataSources: ApolloDataSources = {
        pokemonAPI: new PokemonAPI({ cache }),
      };

      return { dataSources };
    }
  });

After:

  const handleGraphQLRequest = startServerAndCreateCloudflareHandler(server, {
    cors: options.cors,
    context: async () => {
      const cache = options.kvCache ? new KVCache() : server.cache;

      const dataSources: ApolloDataSources = {
        pokemonAPI: new PokemonAPI({ cache }),
      };

      return { dataSources };
    }
  });

  const response = await handleGraphQLRequest(request);