A simple logging example of GraphQL Federation. This project using stack below.
- NestJS (Express, Code First)
- Apollo Gateway
- Apollo Federation
Launch the two applications first, then the gateway. Otherwise the gateway failed launch.
cd application-posts && yarn start
cd application-users && yarn start
cd gateway && yarn start
You can access the gateway at http://localhost:3000.
query QueryPosts {
posts {
id
title
user {
id
name
}
}
}
query userWithPosts($userId: ID!) {
user(id: $userId) {
id
name
posts {
authorId
id
title
}
}
}