How to use the @nestjs/graphql.GraphQLModule.forRootAsync function in @nestjs/graphql

To help you get started, we’ve selected a few @nestjs/graphql examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github awesome-graphql-space / lina / src / server / app.module.ts View on Github external
import { GraphQLModule } from '@nestjs/graphql';
import { Module } from '@nestjs/common';
import { AppController } from './app.controller';
// import { UsersModule } from './users/users.module';
import { CommonsModule } from './commons/commons.module';
// import { ConfigModule } from './config/config.module';
// import { ConfigService } from 'config/config.service';
// import { AuthModule } from './auth/auth.module';
// import { ArangodbModule } from 'arangodb/arangodb.module';
import { GraphqlOptions } from './graphql.options';

@Module({
  imports: [
    CommonsModule,
    GraphQLModule.forRootAsync({
      useClass: GraphqlOptions,
    }),
  ],
  controllers: [AppController],
  providers: [],
})
export class AppModule {
  constructor(){}
}
github jo0ger / node-server / src / app.module.ts View on Github external
import { GraphQLModule } from '@nestjs/graphql'
import { GraphqlService } from './config/graphql/graphql.service'
import { CategoryModule } from './modules/category/category.module';

@Module({
  imports: [
    VarModule,
    ArticleModule,
    LoggerModule,
    TypeormModule,
    TypeOrmModule.forRootAsync({
      // TIP: Here need to import the VarModule for using VarService
      imports: [VarModule],
      useClass: TypeormService
    }),
    GraphQLModule.forRootAsync({
      imports: [VarModule, LoggerModule],
      useClass: GraphqlService
    }),
    CategoryModule
  ],
  controllers: [AppController],
  providers: [AppService, TypeormService]
})
export class AppModule {}
github notadd / nt-cms / starter / app.module.ts View on Github external
import { Module } from '@nestjs/common';
import { GraphQLModule } from '@nestjs/graphql';
import { TypeOrmModule } from '@nestjs/typeorm';
import { GraphqlConfig } from './graphql.config';
import { CmsModule } from '../src/cms/cms.module';
import { UserModule } from '../src/user/user.module';

@Module({
    imports: [
        GraphQLModule.forRootAsync({
            useClass: GraphqlConfig
        }),
        TypeOrmModule.forRoot(),
        CmsModule,
        UserModule
    ],
    controllers: [],
    providers: [],
    exports: []
})
export class AppModule { }
github neoteric-eu / nestjs-auth / src / app / app.module.ts View on Github external
import {SecurityModule} from './security';

@Module({
	imports: [
		CommandModule,
		HealthCheckModule,
		SecurityModule,
		DatabaseModule,
		AuthModule,
		UserModule,
		MediaModule,
		HomeModule,
		HomeFavoriteModule,
		HomeMediaModule,
		MessageModule,
		GraphQLModule.forRootAsync({
			imports: [UserModule],
			useClass: GqlConfigService
		})
	]
})
export class AppModule {
	private logger = new AppLogger(AppModule.name);

	constructor() {
		this.logger.log('Initialize constructor');
	}

	configure(consumer: MiddlewareConsumer) {
		consumer
			.apply(RequestContextMiddleware)
			.forRoutes({path: '*', method: RequestMethod.ALL});
github chnirt / nestjs-graphql-best-practice / src / app.module.ts View on Github external
TranslateResolver,
	UserResolver,
	UserResultResolver
} from './resolvers'
import { CacheModule, Module } from '@nestjs/common'
import { CacheService, GraphqlService, TypeormService } from './config'

import { AppController } from './app.controller'
import { DateScalar } from './config/graphql/scalars/date.scalar'
import { GraphQLModule } from '@nestjs/graphql'
import { TypeOrmModule } from '@nestjs/typeorm'
import { UploadScalar } from './config/graphql/scalars/upload.scalar'

@Module({
	imports: [
		GraphQLModule.forRootAsync({
			useClass: GraphqlService
		}),
		TypeOrmModule.forRootAsync({
			useClass: TypeormService
		}),
		CacheModule.registerAsync({
			useClass: CacheService
		})
	],
	controllers: [AppController],
	providers: [
		DateScalar,
		UploadScalar,
		UserResolver,
		ResultResolver,
		UserResultResolver,
github jmcdo29 / zeldaPlay / apps / api / src / app / app.module.ts View on Github external
GraphQLModuleConfig,
  OgmaModuleConfig,
  TerminusOptionsService,
} from './options';
import { SpellModule } from './spell/spell.module';

@Module({
  imports: [
    ConfigModule.forRootAsync(ConfigModule, {
      useClass: ConfigModuleConfig,
    }),
    DatabaseModule.forRootAsync({
      imports: [ConfigModule.Deferred],
      useClass: DatabaseModuleConfig,
    }),
    GraphQLModule.forRootAsync({
      imports: [ConfigModule.Deferred],
      useClass: GraphQLModuleConfig,
    }),
    TerminusModule.forRootAsync({
      useClass: TerminusOptionsService,
    }),
    OgmaModule.forRootAsync({
      useClass: OgmaModuleConfig,
      imports: [ConfigModule.Deferred],
    }),
    AuthModule,
    CharacterModule,
    AbilityScoreModule,
    SpellModule,
  ],
  providers: [AppService, AppResolver],
github notadd / nt-module-user / stater / app.module.ts View on Github external
import { Module } from '@nestjs/common';
import { GraphQLModule } from '@nestjs/graphql';
import { TypeOrmModule } from '@nestjs/typeorm';

import { UserModule } from '../src';
import { GraphQLConfigService } from './graphql-config.service';

@Module({
    imports: [
        GraphQLModule.forRootAsync({
            useClass: GraphQLConfigService
        }),
        TypeOrmModule.forRoot({
            type: 'postgres',
            host: 'localhost',
            port: 5432,
            username: 'postgres',
            password: '123456',
            database: 'module_user',
            entities: [__dirname + '/../src/**/*.entity.ts'],
            logger: 'simple-console',
            logging: false,
            synchronize: true,
            dropSchema: false
        }),
        UserModule.forRoot({ i18n: 'zh-CN' })
github SolidZORO / leaa / packages / leaa-api / src / app.module.ts View on Github external
import { AttachmentModule } from '@leaa/api/src/modules/attachment/attachment.module';
import { PermissionModule } from '@leaa/api/src/modules/permission/permission.module';
import { SettingModule } from '@leaa/api/src/modules/setting/setting.module';
import { OauthModule } from '@leaa/api/src/modules/oauth/oauth.module';
import { TagModule } from '@leaa/api/src/modules/tag/tag.module';
import { CouponModule } from '@leaa/api/src/modules/coupon/coupon.module';
import { PromoModule } from '@leaa/api/src/modules/promo/promo.module';
import { ProductModule } from '@leaa/api/src/modules/product/product.module';

@Module({
  imports: [
    CacheModule.register(),
    TypeOrmModule.forRootAsync({
      useClass: TypeormService,
    }),
    GraphQLModule.forRootAsync({
      imports: [AuthModule],
      useClass: GraphqlService,
    }),
    ConfigModule,
    SeedModule,
    PlaygroundModule,
    IndexModule,
    //
    AuthModule,
    UserModule,
    PermissionModule,
    RoleModule,
    CategoryModule,
    ArticleModule,
    AttachmentModule,
    AxModule,
github ForetagInc / fullstack-ts-boilerplate / apps / api / src / app / app.module.ts View on Github external
import { GraphQLModule } from '@nestjs/graphql';
import { TerminusModule } from '@brunnerlivio/terminus';

import { GraphqlOptions } from './graphql.options';
import { TerminusService } from './terminus.service';

import { AppController } from './app.controller';
import { CommonModule } from './common.module';
import { PrismaModule } from './prisma';
import { UserModule } from './user';
import { AuthModule } from './auth';

@Module({
  controllers: [AppController],
  imports: [
    GraphQLModule.forRootAsync({
      useClass: GraphqlOptions,
    }),
    TerminusModule.forRootAsync({
      useClass: TerminusService,
    }),
    CommonModule,
    PrismaModule,
    AuthModule,
    UserModule,
  ],
})
export class AppModule {}
github vendure-ecommerce / vendure / packages / core / src / api / config / configure-graphql-module.ts View on Github external
export function configureGraphQLModule(
    getOptions: (configService: ConfigService) => GraphQLApiOptions,
): DynamicModule {
    return GraphQLModule.forRootAsync({
        useFactory: (
            configService: ConfigService,
            i18nService: I18nService,
            idCodecService: IdCodecService,
            typesLoader: GraphQLTypesLoader,
        ) => {
            return createGraphQLOptions(
                i18nService,
                configService,
                idCodecService,
                typesLoader,
                getOptions(configService),
            );
        },
        inject: [ConfigService, I18nService, IdCodecService, GraphQLTypesLoader],
        imports: [ConfigModule, I18nModule, ApiSharedModule],