-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathapp.module.ts
35 lines (32 loc) · 1.11 KB
/
app.module.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import { Module, NestModule, MiddlewareConsumer } from '@nestjs/common';
import { TypeOrmModule } from '@nestjs/typeorm';
import config from "./src/config/config";
import { UserModule } from './src/modules/users/user.module';
import { AuthModule } from './src/modules/auth/auth.module';
import { ActivityLogModule } from './src/modules/activity-logs/activity-log.module';
import { LoggerMiddleware } from './src/common/middlewares/loggere.middleware';
@Module({
imports: [
TypeOrmModule.forRoot({
type: 'mysql',
host: config.dbHost,
port: config.dbPort,
username: config.dbUserName,
password: config.dbPassword,
database: config.dbName,
entities: [__dirname + '/**/**/*.entity{.ts,.js}'],
synchronize: true,
}),
AuthModule,
UserModule,
ActivityLogModule
],
})
export class ApplicationModule implements NestModule {
configure(consumer: MiddlewareConsumer) {
consumer
.apply(LoggerMiddleware)
.with('AppModule')
.forRoutes('users')
}
}