node.jsexpressinversifyjs

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. 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?


Solution

  • Instead of using the @controller decorator, you can use the function
    controller(path, middleware)(SomeClass); to manually create a controller