dwyl / dwyl/learn-node-js-by-example

Dependency Injection in nodejs, yes or no?

Open
#31 4 comments 0 reactions 0 assignees View on GitHub
help wanted question
Dominant language
HTML
Stars
48
Forks
11
PR merge metrics
No merged PRs in 30d

Description

# Dependency Injection

I come from a Java background where **DI** is a very good approach to build a solid code base. I am interested to hear what the **nodejs** community thinks about this and if the same logic applies.

## Why DI?
DI makes your code more modular since you pass along your dependencies rather then requiring them.
It also makes _unit testing_ a lot easier since you can just pass in fake representations of your dependencies without having to do some complex mocking.

## Why not?
This is the question I would like to see answered.

## Articles
https://blog.risingstack.com/dependency-injection-in-node-js/
https://www.devbridge.com/articles/dependency-injection-in-javascript/
https://medium.com/@Jeffijoe/dependency-injection-in-node-js-2016-edition-f2a88efdd427#.jxijeinhq

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.