Spaces:
Sleeping
Sleeping
import { MiddlewareConsumer, Module, NestModule } from '@nestjs/common'; | |
import { AppController } from './app.controller.js'; | |
import { AppService } from './app.service.js'; | |
import { ConfigModule } from '@nestjs/config'; | |
import { TypeOrmModule } from '@nestjs/typeorm'; | |
import { configuration } from './config/config.js'; | |
import { DatabaseConfigService } from './config/database.js'; | |
import { AppLoggerMiddleware } from './common/middlewares/app-logger.middleware.js'; | |
import { DeviceInfoMiddleware } from './common/middlewares/device-info.middleware.js'; | |
import { UserModule } from './modules/user/user.module.js'; | |
import { BranchModule } from './modules/branch/branch.module.js'; | |
import { AuthenticationModule } from './modules/authentication/authentication.module.js'; | |
import { MenuItemModule } from './modules/menu-item/menu-item.module.js'; | |
import { FeedsModule } from './modules/feeds/feeds.module.js'; | |
import { OrderModule } from './modules/order/order.module.js'; | |
import { BranchMenusModule } from './modules/branch-menus/branch-menus.module.js'; | |
import { PaymentModule } from './payment/payment.module.js'; | |
({ | |
imports: [ | |
ConfigModule.forRoot({ | |
isGlobal: true, | |
load: [configuration], | |
}), | |
TypeOrmModule.forRootAsync({ | |
imports: [ConfigModule], | |
useClass: DatabaseConfigService, | |
}), | |
UserModule, | |
BranchModule, | |
AuthenticationModule, | |
MenuItemModule, | |
FeedsModule, | |
OrderModule, | |
BranchMenusModule, | |
PaymentModule, | |
], | |
controllers: [AppController], | |
providers: [AppService], | |
}) | |
export class AppModule implements NestModule { | |
configure(consumer: MiddlewareConsumer): void { | |
consumer.apply(AppLoggerMiddleware).forRoutes('*'); | |
consumer.apply(DeviceInfoMiddleware).forRoutes('*'); | |
} | |
} | |