Demo application of using DGS framework together with Apollo Federation Server.
The repository contains three dgs microservices:
game-dgs
: Spring Boot GraphQL service providing the federatedGame
type.user-dgs
: Spring Boot GraphQL service providing the federatedUser
type.review-dgs
: Spring Boot GraphQL service extendingGame
andUser
type withReview
.
And a apollo-gateway
acting as the Federated Gateway connecting the three microservices.
The image below summarize the relation between them:
- Start
game-dgs
by running the Spring Boot app from an IDE ormvn spring-boot:run
. - Start
user-dgs
by running the Spring Boot app from an IDE ormvn spring-boot:run
. - Start
review-dgs
by running the Spring Boot app from an IDE ormvn spring-boot:run
. - Run
npm install
inapollo-gateway
and thennpm run server
. - Open http://localhost:4000 in the GraphQL Playground.
The following federated queries should work when all microservices are up:
{
games {
name
releaseYear
reviews {
comment
starRating
}
}
}
{
users {
username
reviews {
comment
starRating
}
}
}
{
reviews {
comment
starRating
game {
name
}
user {
username
}
}
}
Made by Lucas Reis