天天看點

Nest 中在目前子產品使用其他子產品 service 的方式

目前子產品使用其他子產品 service 方式

将其他子產品的 module 導入到 目前子產品 module 檔案中的 imports 中

在目前子產品需要的地方,比如 controller 或 service 檔案中引入其他子產品的 service,并在對應檔案的 constructor 函數參數中使用 private readonly otherService: otherService 的方式注入

在其他路由方法中即可使用 this.otherService 的方式調用其他子產品 service 中定義的方法

繼續閱讀