Last active
July 29, 2022 15:40
-
-
Save omarberrami/d6bf3eefee8e967b836a44b10e2679ff to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Module } from '@nestjs/common'; | |
import { AuthService } from './auth.service'; | |
import { AuthController } from './auth.controller'; | |
import { TypeOrmModule } from '@nestjs/typeorm'; | |
import { User } from 'src/user/entities/user.entity'; | |
import { JwtModule, JwtService } from '@nestjs/jwt'; | |
import { PassportModule } from '@nestjs/passport'; | |
import { UserModule } from 'src/user/user.module'; | |
import { ConfigModule, ConfigService } from '@nestjs/config'; | |
import { UserService } from 'src/user/user.service'; | |
import { JwtStrategy } from 'src/core/passeport-strategies/jwt-strategy.service'; | |
@Module({ | |
imports: [ | |
TypeOrmModule.forFeature([User]), | |
ConfigModule, | |
PassportModule, | |
UserModule, | |
JwtModule.registerAsync({ | |
imports: [ConfigModule], | |
useFactory: async (configService: ConfigService) => { | |
return { | |
secret: configService.get('JWT_SECRET'), | |
signOptions: { expiresIn: configService.get('JWT_EXPIRE_ON') }, | |
} | |
}, | |
inject: [ConfigService], | |
}), | |
], | |
providers: [AuthService, JwtService, UserService, JwtStrategy], | |
controllers: [AuthController], | |
exports: [AuthService], | |
}) | |
export class AuthModule { } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment