32 lines
813 B
TypeScript
32 lines
813 B
TypeScript
import { Module } from '@nestjs/common';
|
|
import { TypeOrmModule } from '@nestjs/typeorm';
|
|
import { GraphQLModule } from '@nestjs/graphql';
|
|
import { ConfigModule } from '@nestjs/config';
|
|
import { getConnectionOptions } from 'typeorm';
|
|
import path from 'path';
|
|
import { ItemsModule } from './items/items.module';
|
|
|
|
@Module({
|
|
imports: [
|
|
ConfigModule.forRoot({
|
|
envFilePath: '.env',
|
|
}),
|
|
ItemsModule,
|
|
TypeOrmModule.forRootAsync({
|
|
useFactory: async () => ({
|
|
...(await getConnectionOptions()),
|
|
autoLoadEntities: true,
|
|
}),
|
|
}),
|
|
GraphQLModule.forRoot({
|
|
// debug: false,
|
|
playground: false,
|
|
path: '/api/graphql',
|
|
autoSchemaFile: path.join(__dirname, 'schema.gql'),
|
|
}),
|
|
],
|
|
controllers: [],
|
|
providers: [],
|
|
})
|
|
export class AppModule {}
|