I am using MongooseModule and my custom AppConfigService that implements MongooseOptionsFactory interface.
so I am able to use just class name in configuration of mongoose:
@Module({
imports: [
AppConfigModule,
MongooseModule.forRootAsync({
imports: [AppConfigModule],
useExisting: AppConfigService,
inject: [AppConfigService],
}),
AuthModule,
],
controllers: [AppController],
})
export class AppModule {}
I do not understand why I must specify imports and inject properties here. AppConfigModule exports AppConfigService.
I do not know if it makes any difference, but I am using Fastify.