This repository has been archived on 2024-06-14. You can view files and clone it, but cannot push or open issues or pull requests.
icynet-auth-server/src/modules/static-front-end/static-front-end.module.ts

47 lines
1.3 KiB
TypeScript
Raw Normal View History

2022-08-27 08:59:26 +00:00
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('*');
}
}