initialize the jwt module

This commit is contained in:
Sven Czarnian
2022-11-03 01:09:43 +01:00
parent 1d7f9e7e5a
commit dbe7e7ef42

View File

@@ -1,9 +1,22 @@
import { HttpModule } from '@nestjs/axios';
import { Module } from '@nestjs/common';
import { ConfigService } from '@nestjs/config';
import { JwtModule } from '@nestjs/jwt';
import { AuthController } from './auth.controller';
import { JwtStrategy } from './strategies/jwt.strategy';
@Module({
imports: [HttpModule],
imports: [
HttpModule,
JwtModule.registerAsync({
inject: [ConfigService],
useFactory: async (config: ConfigService) => ({
secret: config.get<string>('server.jwt-secret'),
signOptions: { expiresIn: '1h' },
}),
}),
],
providers: [JwtStrategy],
controllers: [AuthController],
})
export class AuthModule {}