Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/juicycleff/nestjs-graphql-gateway
Apollo Federation support for NextJS GraphQL module. Note: There is support for federation in the official package now so this project is deprecated
https://github.com/juicycleff/nestjs-graphql-gateway
apollo-federation apollo-gateway apollographql graphql library nestjs nestjs-graphql
Last synced: about 2 months ago
JSON representation
Apollo Federation support for NextJS GraphQL module. Note: There is support for federation in the official package now so this project is deprecated
- Host: GitHub
- URL: https://github.com/juicycleff/nestjs-graphql-gateway
- Owner: juicycleff
- License: mit
- Archived: true
- Created: 2019-10-26T17:05:37.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2020-02-13T13:53:52.000Z (almost 5 years ago)
- Last Synced: 2024-04-14T09:58:57.515Z (7 months ago)
- Topics: apollo-federation, apollo-gateway, apollographql, graphql, library, nestjs, nestjs-graphql
- Language: TypeScript
- Homepage:
- Size: 688 KB
- Stars: 14
- Watchers: 3
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
NestJs GraphQL Gateway (supports type-graphql)
NestJS GraphQL Apollo Federation extension. You keep using @nestjs/graphql for all other steps
## Installation
```bash
$ yarn install nestjs-graphql-gateway
```## Setup federated service
```typescript
import { Module } from '@nestjs/common';
import { GraphqlDistributedModule } from 'nestjs-graphql-gateway';@Module({
imports: [
GraphqlDistributedModule.forRoot({
typePaths: [path.join(process.cwd() + '/apps/service-auth/src', '/**/*.graphql')],
introspection: true,
playground: {
workspaceName: 'GRAPHQL CQRS',
settings: {
'editor.theme': 'light',
},
},
context: (ctx) => ctx,
})
]
})
export class AppModule {}// Code first TypegraphQl
@Module({
imports: [
GraphqlDistributedModule.forRoot({
autoSchemaFile: 'graphs/demo.gql',
// optional orphaned types
buildSchemaOptions: {
orphanedTypes: [Tenant, TenantMember, User],
},
context: (ctx) => ctx,
})
]
})
export class AppModule {}
```## Setup Gateway
```typescript
import { Module } from '@nestjs/common';
import { GraphqlDistributedGatewayModule } from 'nestjs-graphql-gateway';@Module({
imports: [
GraphqlDistributedGatewayModule.forRoot({
subscriptions: false,
path: '/graphql',
context: context => context,
serviceList: [
{ name: 'auth', url: 'http://localhost:1000/graphql' },
{ name: 'user', url: 'http://localhost:2000/graphql' },
// more services
],
buildService({ url }) {
return new HeadersDatasource({ url });
},
}),
]
})
export class AppModule {}
```## License
This project is [MIT licensed](LICENSE).