Files
nest/sample/31-graphql-federation-code-first
dependabot[bot] 0b6e59ba46 chore(deps): bump http-cache-semantics
Bumps [http-cache-semantics](https://github.com/kornelski/http-cache-semantics) from 4.1.0 to 4.1.1.
- [Release notes](https://github.com/kornelski/http-cache-semantics/releases)
- [Commits](https://github.com/kornelski/http-cache-semantics/commits)

---
updated-dependencies:
- dependency-name: http-cache-semantics
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-02-02 10:54:19 +00:00
..
2023-01-27 07:24:51 +00:00
2021-07-27 12:55:09 +02:00

GraphQL Federation - Code First

A simple example of GraphQL Federation using Code First approach.

Execution

Make sure to start the two sub-graph applications first, then the gatway. 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
    }
  }
}