【发布时间】:2020-07-22 03:49:20
【问题描述】:
我的文件是这样的,
app.module.ts
item.schema.ts
items.module.ts
items.service.ts
【问题讨论】:
我的文件是这样的,
app.module.ts
item.schema.ts
items.module.ts
items.service.ts
【问题讨论】:
只需从 AppModule 中删除 ItemsService 并将其导出到您的 ItemsModule 上,无需在 AppModule 上定义 ItemsController,在 ItemsModule 上定义就足够了。
您可以通过此链接https://docs.nestjs.com/modules查看有关控制器和导出的信息
【讨论】:
我在声明 mongo 模型的其他模块中使用 forwardRef,如下所示:
@Module({
imports: [
forwardRef(() => AppModule),
MongooseModule.forFeature([{ name: 'User', schema: UserSchema }])
]
})
我的 app.module 的 AppModule 在哪里
【讨论】: