This is an example project to demonstrate how we can use Apollo Federation + Apollo Gateway to create a federated gateway across our microservices.
For the sake of simplicity I've created two services here - Post and Comment, which sit behind a Gateway.
cd post
andyarn start
- Server will run onhttp://localhost:4001
cd comment
andyarn start
- Server will run onhttp://localhost:4002
cd gateway
andyarn start
- Gateway will run onhttp://localhost:4000
Go to http://localhost:4000
(which is the gateway endpoint)
query {
posts {
id
title
content
postComments {
id
title
content
postId
}
}
}
query {
comments {
id
title
postId
post {
id
title
}
}
}