Skip to content

Instantly share code, notes, and snippets.

@tsh-code
Created October 18, 2021 09:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tsh-code/4d78418735ba83182ea6d8fd4949dbdb to your computer and use it in GitHub Desktop.
Save tsh-code/4d78418735ba83182ea6d8fd4949dbdb to your computer and use it in GitHub Desktop.
Apollo Federation - gateway service
const { ApolloServer } = require("apollo-server");
const { ApolloGateway } = require("@apollo/gateway");
const gateway = new ApolloGateway({
serviceList: [
{ name: "posts", url: "http://localhost:5001" },
{ name: "comments", url: "http://localhost:5002" },
],
});
const server = new ApolloServer({
gateway,
});
server.listen({ port: 5000 }).then(({ url }) => console.log(`Gateway ready at ${url}`));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment