DEV Community

Discussion on: The Node.js way - DI vs Module Require?!

Collapse
 
imthedeveloper profile image
ImTheDeveloper

To follow up on these comments I've spent the last couple of days working through my code, refactoring my structure and in general just giving different methods a try. I've actually found a nice middle ground between injecting some dependencies to ensure loose coupling and easy testability vs hard locking things together with directly required modules.

Overall quite happy with the route I've gone. I can imagine in the future if my App were to grow and grow the benefits of an IoC and registering all of the dependencies in a central store.

For anyone looking for a good guide on all of this I forgot I had actually got a copy of "Node.js design patterns" which has a chapter specifically discussing all of this topic named "Wiring Modules". I've also noticed google and other searches react well to the same phrase.