Created
October 18, 2021 09:17
-
-
Save tsh-code/4d78418735ba83182ea6d8fd4949dbdb to your computer and use it in GitHub Desktop.
Apollo Federation - gateway service
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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