In order to solve it you have to remove the ItemsController and ItemsService imports from the app.module.ts file.
This was the solution because:
- You already import ItemsController and ItemsService in your
items.module.tsfile so it’s not necessary to import
them again in theapp.module.tsfile. - In your
items.module.tsyou have the next line:@Module({ imports: [MongooseModule.forFeature([{ name: 'Item', schema: ItemSchema }])], ... })which is necessary to make the dependency injection in the
items.service.tsfile works, as you can check in the
app.module.tsfile you don’t have that line. - Of course you can add that line to your
app.module.tsfile but then there’s no sense to create the
items.module.tsfile.
Check my repo xD.