Re:Why and how to use service injection in Node.js
by jiripospisil on Sunday October 31, 2021 @02:00PM
(#29058895)
Yeah, this is more like the "Service locator" pattern where you use a single object (the locator) to bring in other objects. Years ago I wrote dependency injection container for JavaScript [0] and under the hood it indeed works similarly to a service locator but the difference is in the usage. Your application code should have no knowledge of where the constructed object is coming from, it should not explicitly grab it from some object.
[0] https://github.com/jiripospisil/ashley