mirror of
https://github.com/graphql-hive/console
synced 2026-05-22 16:48:56 +00:00
Docs/Gateway: NestJS integration (#6545)
Co-authored-by: Denis Badurina <badurinadenis@gmail.com> Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
This commit is contained in:
parent
adc5437050
commit
cbc79a47ca
1 changed files with 60 additions and 0 deletions
|
|
@ -0,0 +1,60 @@
|
|||
---
|
||||
description:
|
||||
Hive Gateway Driver for Nest (Nest JS) is a Node.js framework for building server-side
|
||||
applications.
|
||||
---
|
||||
|
||||
import { Callout } from '@theguild/components'
|
||||
|
||||
# Integration with NestJS
|
||||
|
||||
[Nest (Nest JS)](https://nestjs.com) is a progressive Node.js framework for building efficient,
|
||||
reliable and scalable server-side applications.
|
||||
|
||||
Hive Gateway provides its own Nest GraphQL Driver that supports building
|
||||
[GraphQL Federation](https://the-guild.dev/graphql/hive/federation) gateways.
|
||||
|
||||
<Callout>
|
||||
For the setup of a new Nest project, please make sure to read the [Nest GraphQL
|
||||
documentation](https://docs.nestjs.com/graphql/quick-start).
|
||||
</Callout>
|
||||
|
||||
## Install
|
||||
|
||||
```sh npm2yarn
|
||||
npm i @nestjs/graphql @graphql-hive/nestjs graphql
|
||||
```
|
||||
|
||||
## Create Application Module
|
||||
|
||||
```typescript
|
||||
import { HiveGatewayDriver, HiveGatewayDriverConfig } from '@graphql-hive/nestjs'
|
||||
import { Module } from '@nestjs/common'
|
||||
import { GraphQLModule } from '@nestjs/graphql'
|
||||
|
||||
@Module({
|
||||
imports: [
|
||||
GraphQLModule.forRoot<HiveGatewayDriverConfig>({
|
||||
driver: HiveGatewayDriver,
|
||||
// All configuration for Hive Gateway comes here;
|
||||
supergraph: './supergraph.graphql',
|
||||
// Install subscription handlers to the server
|
||||
installSubscriptionHandlers: true,
|
||||
subscriptions: {
|
||||
// Enable WebSocket subscriptions
|
||||
'graphql-ws': true
|
||||
}
|
||||
})
|
||||
]
|
||||
})
|
||||
export class AppModule {}
|
||||
```
|
||||
|
||||
<Callout>
|
||||
Learn more about subscriptions in Hive Gateway [here](/docs/gateway/subscriptions).
|
||||
</Callout>
|
||||
|
||||
## Further development
|
||||
|
||||
Hive Gateway offers just a gateway driver; meaning, everything else works as
|
||||
[showcased in Nest federation documentation](https://docs.nestjs.com/graphql/federation).
|
||||
Loading…
Reference in a new issue