Spaces:
Sleeping
Sleeping
| import { Module } from '@nestjs/common'; | |
| import { JwtModule } from '@nestjs/jwt'; | |
| import { ConfigModule, ConfigService } from '@nestjs/config'; | |
| import { TypeOrmModule } from '@nestjs/typeorm'; | |
| import { PassportModule } from '@nestjs/passport'; | |
| import { AuthService } from './auth.service'; | |
| import { AuthController } from './auth.controller'; | |
| import { User } from '../entities/user.entity'; | |
| import { JwtStrategy } from './strategies/jwt.strategy'; | |
| ({ | |
| imports: [ | |
| TypeOrmModule.forFeature([User]), | |
| PassportModule, | |
| JwtModule.registerAsync({ | |
| imports: [ConfigModule], | |
| useFactory: async (configService: ConfigService) => ({ | |
| secret: configService.get<string>('JWT_SECRET'), | |
| signOptions: { expiresIn: '7d' }, | |
| }), | |
| inject: [ConfigService], | |
| }), | |
| ], | |
| providers: [AuthService, JwtStrategy], | |
| controllers: [AuthController], | |
| exports: [AuthService], | |
| }) | |
| export class AuthModule {} | |