天天看点

Nest 中在当前模块使用其他模块 service 的方式

当前模块使用其他模块 service 方式

将其他模块的 module 导入到 当前模块 module 文件中的 imports 中

在当前模块需要的地方,比如 controller 或 service 文件中引入其他模块的 service,并在对应文件的 constructor 函数参数中使用 private readonly otherService: otherService 的方式注入

在其他路由方法中即可使用 this.otherService 的方式调用其他模块 service 中定义的方法

继续阅读