You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/graphql/federation.md
+11Lines changed: 11 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -136,6 +136,10 @@ import { UsersService } from './users.service'; // Not included in this example
136
136
exportclassAppModule {}
137
137
```
138
138
139
+
#### Example
140
+
141
+
A working example is available [here](https://github.com/nestjs/nest/tree/master/sample/31-graphql-federation-code-first/users-application) in code first mode and [here](https://github.com/nestjs/nest/tree/master/sample/32-graphql-federation-schema-first/users-application) in schema first mode.
142
+
139
143
#### Federated example: Posts
140
144
141
145
Our Post service serves aggregated posts via a `getPosts` query, but also extends our `User` type with `user.posts`
@@ -318,6 +322,9 @@ import { PostsService } from './posts.service'; // Not included in example
318
322
})
319
323
exportclassAppModule {}
320
324
```
325
+
#### Example
326
+
327
+
A working example is available [here](https://github.com/nestjs/nest/tree/master/sample/31-graphql-federation-code-first/posts-application) in code first mode and [here](https://github.com/nestjs/nest/tree/master/sample/32-graphql-federation-schema-first/posts-application) in schema first mode.
321
328
322
329
#### Federated example: Gateway
323
330
@@ -354,6 +361,10 @@ export class AppModule {}
354
361
355
362
> info **Hint** Apollo recommends that you don't rely on the service discovery in a production environment but use their [Graph Manager](https://www.apollographql.com/docs/graph-manager/federation/) instead.
356
363
364
+
#### Example
365
+
366
+
A working example is available [here](https://github.com/nestjs/nest/tree/master/sample/31-graphql-federation-code-first/gateway) in code first mode and [here](https://github.com/nestjs/nest/tree/master/sample/32-graphql-federation-schema-first/gateway) in schema first mode.
367
+
357
368
#### Sharing context
358
369
359
370
You can customize the requests between the gateway and federated services using a build service. This allows you to share context about the request. You can easily extend the default `RemoteGraphQLDataSource` and implement one of the hooks. Please refer to [Apollo Docs](https://www.apollographql.com/docs/apollo-server/api/apollo-gateway/#remotegraphqldatasource) on `RemoteGraphQLDataSource` for more information about the possibilities.
0 commit comments