27 lines
758 B
TypeScript
27 lines
758 B
TypeScript
import { Module } from '@nestjs/common';
|
|
import { AppController } from './app.controller';
|
|
import { AppService } from './app.service';
|
|
import { ConfigModule, ConfigService } from '@nestjs/config';
|
|
import { MongooseModule } from '@nestjs/mongoose';
|
|
import { FormModule } from './form/form.module';
|
|
import { FormService } from './form/form.service';
|
|
|
|
|
|
@Module({
|
|
imports: [
|
|
ConfigModule.forRoot({ isGlobal: true }), //access env anywhere
|
|
|
|
// connect db
|
|
MongooseModule.forRootAsync({
|
|
inject: [ConfigService],
|
|
useFactory: (configService: ConfigService) => ({
|
|
uri: configService.get<string>('DB_URI'),
|
|
}),
|
|
}),
|
|
FormModule,
|
|
],
|
|
controllers: [AppController,],
|
|
providers: [AppService],
|
|
})
|
|
export class AppModule {}
|