Search code examples
node.jsexpressnestjsnest-api

Nest can't resolve dependencies of the RegisterService (?).Please make sure that the argument at index [0] is available in the RegisterModule context


I am facing this problem in nestjs.Project structure is like-

src-
    -RegisterModule
       -register.controller.ts
       -register.service.ts
       -register.dto.ts
       -register.schema.ts
       -register.module.ts

    -app.module.ts
    -app.controller.ts
    -app.service.ts

Solution

  • Yaa....I got the solution in just 2 simple steps

    1. Import MongooseModule.forFeature([{ name: 'Register', schema: registrationSchema }]) in registerModule's import section
    2. Import registerModule in appModule