Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

127
Views
Common patterns for Dependency Injection

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+?

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!