feat: add backend-mock app
This commit is contained in:
33
apps/backend-mock/src/modules/auth/auth.module.ts
Normal file
33
apps/backend-mock/src/modules/auth/auth.module.ts
Normal file
@@ -0,0 +1,33 @@
|
||||
import type { JwtConfig } from '@/types';
|
||||
|
||||
import { Module } from '@nestjs/common';
|
||||
import { ConfigService } from '@nestjs/config';
|
||||
import { JwtModule } from '@nestjs/jwt';
|
||||
|
||||
import { UsersModule } from '../users/users.module';
|
||||
import { AuthController } from './auth.controller';
|
||||
import { AuthService } from './auth.service';
|
||||
import { JwtStrategy } from './jwt.strategy';
|
||||
import { LocalStrategy } from './local.strategy';
|
||||
import { JwtRefreshStrategy } from './refresh-token.strategy';
|
||||
|
||||
@Module({
|
||||
controllers: [AuthController],
|
||||
exports: [AuthService],
|
||||
imports: [
|
||||
UsersModule,
|
||||
JwtModule.registerAsync({
|
||||
global: true,
|
||||
inject: [ConfigService],
|
||||
useFactory: async (configService: ConfigService) => {
|
||||
const { expiresIn, secret } = configService.get<JwtConfig>('jwt');
|
||||
return {
|
||||
secret,
|
||||
signOptions: { expiresIn },
|
||||
};
|
||||
},
|
||||
}),
|
||||
],
|
||||
providers: [AuthService, JwtStrategy, JwtRefreshStrategy, LocalStrategy],
|
||||
})
|
||||
export class AuthModule {}
|
Reference in New Issue
Block a user