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.ts
file so it’s not necessary to import
them again in theapp.module.ts
file. - In your
items.module.ts
you have the next line:@Module({ imports: [MongooseModule.forFeature([{ name: 'Item', schema: ItemSchema }])], ... })
which is necessary to make the dependency injection in the
items.service.ts
file works, as you can check in the
app.module.ts
file you don’t have that line. - Of course you can add that line to your
app.module.ts
file but then there’s no sense to create the
items.module.ts
file.
Check my repo xD.