I'm currently refactoring an existing Node.js based REST API project (Express / CouchDB / winston).
Therefore I try to use a layered approach like controller -> services -> db models.
Usually I start splitting the most common parts like logger and conf into separate modules.
Now I read about Dependency Injection and Dependency Inversion Principle (DIP) and I don't fully understand how to apply it.
There are many modules which load the conf and logger via direct import. If I get the principle right, it's better to pass the dependencies as parameter instead of loading it directly.
How did you solve this? Is there a common approach in Node.js with plain ES6+?