Skip to content

Instantly share code, notes, and snippets.

@omarberrami
Last active July 29, 2022 15:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save omarberrami/d6bf3eefee8e967b836a44b10e2679ff to your computer and use it in GitHub Desktop.
Save omarberrami/d6bf3eefee8e967b836a44b10e2679ff to your computer and use it in GitHub Desktop.
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