guard creation and more
This commit is contained in:
+12
-5
@@ -4,15 +4,22 @@ import { AuthService } from './auth.service';
|
||||
import { UsersModule } from '../users/users.module';
|
||||
import { JwtModule } from '@nestjs/jwt';
|
||||
import { AuthController } from './auth.controller';
|
||||
import { jwtConstants } from './constants';
|
||||
import { ConfigService } from '@nestjs/config';
|
||||
|
||||
@Module({
|
||||
imports: [
|
||||
UsersModule,
|
||||
JwtModule.register({
|
||||
global: true,
|
||||
secret: jwtConstants.secret,
|
||||
signOptions: { expiresIn: '60s' },
|
||||
JwtModule.registerAsync({
|
||||
inject:[ConfigService],
|
||||
useFactory:async(configService:ConfigService)=>{
|
||||
return{
|
||||
global: true,
|
||||
secret: configService.get('JWT_SECRET'),
|
||||
signOptions: {
|
||||
expiresIn: configService.get('JWT_EXPIRE')
|
||||
},
|
||||
}
|
||||
}
|
||||
}),
|
||||
],
|
||||
providers: [AuthService],
|
||||
|
||||
Reference in New Issue
Block a user