Closed JamesCoonce closed 6 years ago
You have to export UsersService
and model from the UsersModule
.
I was able to figure the UsersService out what how do I export the model?
I got it working
import { Module } from '@nestjs/common';
import { MongooseModule } from '@nestjs/mongoose';
import { UsersController } from './users.controller';
import { UsersService } from './users.service';
import { UserSchema} from './schemas/user.schema';
@Module({
imports: [MongooseModule.forFeature([{ name: 'User', schema: UserSchema }])],
controllers: [UsersController],
providers: [UsersService],
exports: [UsersService, MongooseModule.forFeature([{ name: 'User', schema: UserSchema }])],
})
export class UsersModule {}
The following code shall work fine as well:
exports: [UsersService, getModelToken('User')],
getModelToken()
comes from @nestjs/mongoose
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
I'm trying to add a JWT Authentication to NestJS but I'mhaving issues with the AuthService and it's dependencies
I'm submitting a...
Current behavior
Nest can't resolve dependencies of the AuthService (?, +). Please verify whether [0] argument is available in the current context.
Expected behavior
nest should be able to see which dependencies are being used for the AuthService
Minimal reproduction of the problem with instructions
https://github.com/JamesCoonce/angular-nest-todo
What is the motivation / use case for changing the behavior?
Environment