Node.js

Dependency Injection

Why Use Dependency Injection

  1. Fast Development process
  2. Decoupling
  3. Unit test writing



Fast Development process
When using dependency injection node developer can faster their development proceess because after DI there is less code conflict and easy to manage all module.

Decoupling
Modules becomes less couple then it is easy to maintain.

Unit test writing
Hardcoded dependencies can pass them into the module then easy to write unit test for each module.


This modified text is an extract of the original Stack Overflow Documentation created by the contributors and released under CC BY-SA 3.0 This website is not affiliated with Stack Overflow