◾️ create auth module and need to use UserService (※ youtube lecture content)
auth.module.ts / auth.controller.ts / auth.service.ts
user.module.ts / user.controller.ts / user.service.ts
import { Module } from '@nestjs/common';
import { UsersModule } from 'src/users/users.module';
import { AuthController } from './auth.controller';
import { AuthService } from './auth.service';
@Module({
imports: [
UsersModule,
],
controllers: [AuthController],
providers: [AuthService],
})
export class AuthModule {}
◾️ UserModule exports UsersService
import { Module } from '@nestjs/common';
import { MongooseModule } from '@nestjs/mongoose';
import { UserSchema } from './schemas/user.schema';
import { UsersController } from './users.controller';
import { UsersService } from './users.service';
@Module({
imports: [MongooseModule.forFeature([{ name: 'User', schema: UserSchema }])],
controllers: [UsersController],
providers: [UsersService],
exports: [UsersService],
})
export class UsersModule {}