Integration with Next.js

Next.js is a web framework that allows you to build websites very quickly and Hive Gateway can be integrated with Next.js easily as an API Route.

Next.js is a web framework that allows you to build websites very quickly and Hive Gateway can be integrated with Next.js easily as a custom route handler.

Example

Please read the relevant Next.js documentation on custom router handlers first.

import { createGatewayRuntime } from "@graphql-hive/gateway-runtime";
import { supergraph } from "./my-supergraph";

const { handleRequest } = createGatewayRuntime({
  supergraph,
  graphqlEndpoint: "/api/graphql",
});

export {
  handleRequest as GET,
  handleRequest as POST,
  handleRequest as OPTIONS,
};

On this page

View on GitHub