[英]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.