0

I am using ApolloGateway to federate graphql subgraphs. Below is the demo code:

const gateway = new ApolloGateway({
  supergraphSdl: new IntrospectAndCompose({
    subgraphs: [
      { name: 'accounts', url: 'http://localhost:4001' },
      { name: 'products', url: 'http://localhost:4002' },
      // ...additional subgraphs...
    ],
  }),
});

The gateway class requires a supergraphSdl which is loading from a remote endpoint. What I am doing is to pre federate the schema into a file by using rover command. And I'd like the ApolloGateway load the schema from that file rather than fetching from the remote server. The schema file can be a file saved in local disk or can be a big string. I only need ApolloGateway to proxy the runtime requests to the sub graph.

Is there a way to achieve it?

Joey Yi Zhao
  • 37,514
  • 71
  • 268
  • 523

0 Answers0