You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
1.0 KiB
30 lines
1.0 KiB
import { Module } from '@nestjs/common'; |
|
import { SequelizeModule } from '@nestjs/sequelize'; |
|
import { ConfigModule, ConfigService } from '@nestjs/config'; |
|
import { JwtModule } from '@nestjs/jwt'; |
|
import { PassportModule } from '@nestjs/passport'; |
|
import { UsersService } from './users.service'; |
|
import { UsersController } from './users.controller'; |
|
import { User } from './entities/user.entity'; |
|
import { JwtAuthGuard } from 'src/users/guard/auth.guard'; |
|
|
|
@Module({ |
|
imports: [SequelizeModule.forFeature([User]), |
|
PassportModule.register({ defaultStrategy: 'jwt' }), |
|
JwtModule.registerAsync({ |
|
imports: [ConfigModule], |
|
inject: [ConfigService], |
|
useFactory: (config: ConfigService) => { |
|
return { |
|
secret: config.get<string>('JWT_SECRET'), |
|
signOptions: { |
|
expiresIn: config.get<string | number>('JWT_EXPIRES', '1h'), |
|
}, |
|
}; |
|
}, |
|
}), |
|
], |
|
controllers: [UsersController], |
|
providers: [UsersService,JwtAuthGuard], |
|
}) |
|
export class UsersModule {}
|
|
|