47 lines
1.3 KiB
TypeScript
47 lines
1.3 KiB
TypeScript
|
import {
|
||
|
MiddlewareConsumer,
|
||
|
Module,
|
||
|
NestModule,
|
||
|
RequestMethod,
|
||
|
} from '@nestjs/common';
|
||
|
import { CSRFMiddleware } from 'src/middleware/csrf.middleware';
|
||
|
import { UserMiddleware } from 'src/middleware/user.middleware';
|
||
|
import { ConfigurationModule } from '../config/config.module';
|
||
|
import { JWTModule } from '../jwt/jwt.module';
|
||
|
import { ObjectsModule } from '../objects/objects.module';
|
||
|
|
||
|
import { LoginModule } from './login/login.module';
|
||
|
import { OAuth2RouterModule } from './oauth2-router/oauth2-router.module';
|
||
|
import { RegisterModule } from './register/register.module';
|
||
|
import { SettingsModule } from './settings/settings.module';
|
||
|
import { TwoFactorModule } from './two-factor/two-factor.module';
|
||
|
|
||
|
@Module({
|
||
|
imports: [
|
||
|
ConfigurationModule,
|
||
|
JWTModule,
|
||
|
|
||
|
ObjectsModule,
|
||
|
|
||
|
LoginModule,
|
||
|
OAuth2RouterModule,
|
||
|
RegisterModule,
|
||
|
SettingsModule,
|
||
|
TwoFactorModule,
|
||
|
],
|
||
|
providers: [],
|
||
|
exports: [],
|
||
|
})
|
||
|
export class StaticFrontEndModule implements NestModule {
|
||
|
configure(consumer: MiddlewareConsumer) {
|
||
|
consumer
|
||
|
.apply(CSRFMiddleware, UserMiddleware)
|
||
|
.exclude(
|
||
|
{ path: 'uploads*', method: RequestMethod.ALL },
|
||
|
{ path: 'public*', method: RequestMethod.ALL },
|
||
|
{ path: 'api*', method: RequestMethod.ALL },
|
||
|
)
|
||
|
.forRoutes('*');
|
||
|
}
|
||
|
}
|