40 lines
1.3 KiB
TypeScript
40 lines
1.3 KiB
TypeScript
import { MiddlewareConsumer, Module } from '@nestjs/common';
|
|
import { DbModule } from './db/db.module';
|
|
import { OracleModule } from './oracle/oracle.module';
|
|
import { AuthModule } from './auth/auth.module';
|
|
import { OriginCheckMiddleware } from './middleware/OriginCheck.middleware';
|
|
import { ReqBodyKeysToUppercaseMiddleware } from './middleware/reqBodyKeysToUppercase.middleware';
|
|
import { ConfigModule } from '@nestjs/config';
|
|
import { MailModule } from './mail/mail.module';
|
|
import { PaypalModule } from './paypal/paypal.module';
|
|
import { PgModule } from './pg/pg.module';
|
|
|
|
@Module({
|
|
imports: [
|
|
ConfigModule.forRoot({ isGlobal: true }),
|
|
AuthModule, PgModule, DbModule, OracleModule, MailModule, PaypalModule
|
|
],
|
|
controllers: [],
|
|
providers: [],
|
|
})
|
|
export class AppModule {
|
|
configure(consumer: MiddlewareConsumer) {
|
|
consumer
|
|
.apply(OriginCheckMiddleware)
|
|
.forRoutes('*'); // Apply to all routes
|
|
|
|
consumer
|
|
.apply(ReqBodyKeysToUppercaseMiddleware)
|
|
.forRoutes('*'); // Apply to all routes
|
|
|
|
// .forRoutes('users'); // Applies to all methods on /users
|
|
|
|
// .forRoutes(UsersController); // Applies to all routes in this controller
|
|
|
|
// .forRoutes(
|
|
// { path: 'users', method: RequestMethod.GET },
|
|
// { path: 'auth/login', method: RequestMethod.POST },
|
|
// );
|
|
}
|
|
}
|