init
This commit is contained in:
@@ -0,0 +1,51 @@
|
||||
import { MikroOrmModule } from '@mikro-orm/nestjs';
|
||||
import { Module } from '@nestjs/common';
|
||||
import dataBaseConfig from './config/mikro-orm.config';
|
||||
import { ConfigModule, ConfigService } from '@nestjs/config';
|
||||
import { UserModule } from './modules/user/user.module';
|
||||
// import { CacheModule } from '@nestjs/cache-manager';
|
||||
// import { cacheConfig } from './config/cache.config';
|
||||
import { UtilsModule } from './modules/utils/utils.module';
|
||||
// import { HttpModule } from '@nestjs/axios';
|
||||
// import { httpConfig } from './config/http.config';
|
||||
import { AuthModule } from './modules/auth/auth.module';
|
||||
import { JwtModule } from '@nestjs/jwt';
|
||||
import { UploaderModule } from './modules/uploader/uploader.module';
|
||||
import { AdminModule } from './modules/admin/admin.module';
|
||||
// import { CacheService } from './modules/utils/cache.service';
|
||||
import { ThrottlerModule } from '@nestjs/throttler';
|
||||
import { SubmitionModule } from './modules/submition/submition.module';
|
||||
|
||||
@Module({
|
||||
imports: [
|
||||
ConfigModule.forRoot({ isGlobal: true, cache: true }),
|
||||
MikroOrmModule.forRootAsync(dataBaseConfig),
|
||||
// CacheModule.registerAsync(cacheConfig()),
|
||||
JwtModule.registerAsync({
|
||||
useFactory: (configService: ConfigService) => ({
|
||||
global: true,
|
||||
secret: configService.getOrThrow<string>('JWT_SECRET'),
|
||||
signOptions: {
|
||||
expiresIn: configService.getOrThrow<number>('JWT_EXPIRATION_TIME'),
|
||||
},
|
||||
}),
|
||||
inject: [ConfigService],
|
||||
}),
|
||||
UserModule,
|
||||
UtilsModule,
|
||||
AuthModule,
|
||||
UploaderModule,
|
||||
AdminModule,
|
||||
ThrottlerModule.forRoot([
|
||||
{
|
||||
ttl: 60, // time window in seconds
|
||||
limit: 5, // max requests per window
|
||||
},
|
||||
]),
|
||||
SubmitionModule
|
||||
],
|
||||
controllers: [],
|
||||
// providers: [CacheService],
|
||||
// exports: [CacheService],
|
||||
})
|
||||
export class AppModule {}
|
||||
Reference in New Issue
Block a user