Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

129
Vistas
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
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda