简体   繁体   English

如何禁用controller的反向自动识别

[英]How to disable inversify auto-recognition of controller

I want to have two servers, living in the same source tree.我想要两台服务器,它们位于同一个源代码树中。 one of the app servers carry a lot of functionality, the other one is more narrowly focused.其中一个应用程序服务器具有很多功能,另一个应用程序服务器的关注范围更窄。 There are common classes to both and really need to share some source between the two servers.两者都有共同的类,确实需要在两个服务器之间共享一些源代码。

This doesn't work as inversify/Express is looking through code for its @controller decorator.这不起作用,因为 inversify/Express 正在查看其 @controller 装饰器的代码。 As soon as it sees that starts to pull in a lot of dependencies because of dependency injection.由于依赖注入,它一看到就开始引入大量依赖项。

How do we disable/manually enable this auto-recognition of the controller in inversify/Express?我们如何在 inversify/Express 中禁用/手动启用对 controller 的自动识别?

Instead of using the @controller decorator, you can use the function您可以使用 function 而不是使用@controller装饰器
controller(path, middleware)(SomeClass); to manually create a controller手动创建一个 controller

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 expressjs逆转控制器中间件错误 - expressjs inversify controller middleware error 如何在反转中注入异步依赖? - How to inject an asynchronous dependency in inversify? 解释:如何绑定模型 <Document> 到容器对象 - inversify: how to bind Model<Document> to container object 难以理解:如何处理与通用接口/类的绑定 - inversify: how to handle binding to a generic interface/class 如何在 Npm 中禁用自动手表 - How to Disable auto watch in Npm 如何在 TypeDI 或 Inversify 中定义第三方依赖 - How to define third-party dependency in TypeDI or Inversify 如何修复错误[ERR_ASSERTION]:构造函数已经存在! (“inversify-restify-utils”:“^ 3.4.0”)和(“inversify-restify-utils”:“^ 3.4.0”) - How to fixed the error [ERR_ASSERTION]: Constructor already exists! (“inversify-restify-utils”: “^3.4.0”) and ( “inversify-restify-utils”: “^3.4.0”) 使用inversify-express-utils,如何集成WebSocket? - Using inversify-express-utils, how can i integrate websockets? 关于用于 inversify-express-utils 的良好 Node Express 多部分文件上传中间件的建议 controller - Advice on good Node Express Multipart File Upload middleware for inversify-express-utils controller 如何禁用webpack dev服务器为中微子项目自动重载? - How to disable webpack dev server auto reload for neutrino project?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM