包详细信息

@apollo/gateway

apollographql964.8kElastic-2.02.11.2

Apollo Gateway

graphql, federation, gateway, server

自述文件

Apollo Gateway

This package provides utilities for combining multiple GraphQL microservices into a single GraphQL endpoint.

Each microservice should implement the federation schema specification. This can be done either through Apollo Federation or a variety of other open source products.

For complete documentation, see the Apollo Gateway API reference.

Usage

import { ApolloServer } from "@apollo/server";
import { startStandaloneServer } from '@apollo/server/standalone';
import { ApolloGateway, IntrospectAndCompose } from "@apollo/gateway";

const gateway = new ApolloGateway({
  supergraphSdl: new IntrospectAndCompose({
    subgraphs: [
       { name: "accounts", url: "http://localhost:4001/graphql" }
       // List of federation-capable GraphQL endpoints...
    ],
  }),
});

const server = new ApolloServer({ gateway });

// Note the top-level await!
const { url } = await startStandaloneServer(server);
console.log(`🚀  Server ready at ${url}`);

更新日志

Changelog

This repository contains multiple JavaScript packages, each with multiple changelogs. Federation 1 is managed on the version-0.x branch, while Federation 2 is managed on the main branch. Please consult the table below to find the changelog you are looking for:

npm package v1 v2
@apollo/gateway changelog changelog
@apollo/query-planner changelog changelog
@apollo/subgraph changelog changelog
@apollo/federation changelog N/A
@apollo/federation-internals N/A changelog
@apollo/query-graphs N/A changelog
@apollo/composition N/A changelog