import { Module } from '@nestjs/common' ; import { GraphQLModule } from '@nestjs/graphql' ; import { TypeOrmModule } from '@nestjs/typeorm' ; import { AuthModule } from './modules/auth/auth.module' ; import { PageModule } from './modules/page/page.module' ; import { UserModule } from './modules/user/user.module' ; import * as ormconifg from './config/ormconfig' ; import { ConfigModule , ConfigService } from '@nestjs/config' ; import { githubConfig } from './config/github.config' ; import { jwtConfig } from './config/jwt.config' ; import { baseConfig } from './config/base.config' ; import { FileModule } from './modules/file/file.module' ; import { awsConfig } from './config/aws.config' ; import { SchoolModule } from './modules/school/school.module' ; import { facebookConfig } from './config/facebook.config' ; import { googleConfig } from './config/google.config' ; import { HealthModule } from './modules/health/health.module' ; @ Module ( { imports : [ ConfigModule . forRoot ( { isGlobal : true , load : [ githubConfig , facebookConfig , googleConfig , jwtConfig , baseConfig , awsConfig , ] , } ) , TypeOrmModule . forRoot ( ormconifg ) , GraphQLModule . forRootAsync ( { inject : [ ConfigService ] , useFactory : async ( configService ) => ( { autoSchemaFile : process . env . NODE_ENV === 'development' ? './schema.graphql' : true , context : ( { req , res } ) => { return { req , res } ; } , playground : { settings : { 'request.credentials' : 'include' , } , } , cors : { origin : configService . get ( 'CLIENT_HOST' ) , credentials : true , } , introspection : true , } ) , } ) , UserModule , AuthModule , PageModule , FileModule , SchoolModule , HealthModule , ] , controllers : [ ] , providers : [ ] , } ) export class AppModule { }