Files
nest/sample/32-graphql-federation-schema-first
dependabot[bot] a7dd69328a chore(deps): bump @apollo/gateway
Bumps [@apollo/gateway](https://github.com/apollographql/federation/tree/HEAD/gateway-js) from 2.4.8 to 2.8.5.
- [Release notes](https://github.com/apollographql/federation/releases)
- [Changelog](https://github.com/apollographql/federation/blob/main/gateway-js/CHANGELOG.md)
- [Commits](https://github.com/apollographql/federation/commits/@apollo/gateway@2.8.5/gateway-js)

---
updated-dependencies:
- dependency-name: "@apollo/gateway"
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-12-03 08:36:40 +00:00
..
2023-02-10 21:39:29 -05:00

GraphQL Federation - Schema First

A simple example of GraphQL Federation using Schema First approach.

Execution

Make sure to start the two sub-graph applications first, then the gateway. Otherwise the gateway won't be able to fetch schemas from the sub-graphs.

cd users-application && npm run start
cd posts-application && npm run start
cd gateway && npm run start

Access the graph

You can reach the gateway under http://localhost:3002/graphql

Query a combined graph

query getUserWithPosts($userId: ID!) {
  getUser(id: $userId) {
    id
    name
    posts {
      authorId
      id
      title
    }
  }
}