0

I would like to accomplish dependency injection in my node/express/es project. I am a newbie to this. Please help

Now my code is being like this

import ClassA from 'classA';
const classA = new ClassA();
classA.doThing();

exports = module.exports = class ClassA {
     constructor() {}
     doThing(){..}
}
Gibi
  • 341
  • 1
  • 2
  • 11
  • It's unclear what you mean. DI is a pattern, it's platform agnostic. For *DI container*, there's a number of third-party solutions, e.g. [Angular DI](https://stackoverflow.com/a/38923612/3731501). – Estus Flask Dec 12 '17 at 04:28
  • Hi, It's both unclear what your question is and it seems an answer would most likely be opinion based, making it a bad fit for questions here. For further information, please see [how to ask good questions](http://stackoverflow.com/help/how-to-ask), and take the [tour of the site](http://stackoverflow.com/tour). – Fred Stark Dec 12 '17 at 04:29
  • Start by reading most of the answers here [What is dependency injection?](https://stackoverflow.com/questions/130794/what-is-dependency-injection) and when you you are stuck, ask a question – Stamos Dec 12 '17 at 09:05

0 Answers0