Hive Gateway a provides you a cross-platform GraphQL Server. So you can easily integrate it into any
platform besides Node.js.
Cloudflare Workers provides a serverless execution
environment that allows you to create entirely new applications or augment existing ones without
configuring or maintaining infrastructure.
See Bundling Problems for more details about
how to load the supergraph and transports option.
In the following example, we showcase how Hive Gateway can be used in a serverless environment with
Cloudflare Workers.
index.js
import { createGatewayRuntime } from "@graphql-hive/gateway-runtime";import http from "@graphql-mesh/transport-http";import supergraph from "./supergraph";export default { async fetch(request, env, ctx) { const gateway = createGatewayRuntime({ // All options available in `gateway.config.ts` configuration can also be passed here. supergraph, transports: { http, // http transport is required for subgraphs using standard GraphQL over HTTP. }, }); const response = await gateway(request, env, ctx); ctx.waitUntil(gateway[Symbol.asyncDispose]()); return response; },};
supergraph.js
export default /* GraphQL */ ` PLACE YOUR SUPERGRAPH SDL HERE`;
This site uses cookies for analytics and improving your experience.