News for hackers. Stuff that matters.
Re:Why and how to use service injection in Node.js by pxeger1 on Sunday October 31, 2021 @12:30PM (#29058145)
IMO the clearest advantage is that you can have multiple parallel instances of the same application but different services with no crosstalk. Basically the same as the disadvantages of using global variables to store state.
Re:Why and how to use service injection in Node.js by donjoe on Sunday October 31, 2021 @02:22PM (#29059076)
... and lots of developers forget that singletons are global state.

Especially with node where you do not have a dedicated sandbox per user request, programming needs to be request-agnostic. This is especially painful with mixing server-side and non-server-side code where you do have a dedicated 'sandbox' on the client side (aka browser).