ajector
v2.1.0
Published
Asynchronous dependency injector
Downloads
5
Readme
ajector
Asynchronous dependency injector.
npm install ajector
Usage
Write modules
// services/Service1.js module.exports = function () { return {}; };
Setup injector
var ajector = require('ajector'); var injector = ajector(__dirname + '/services'); injector.instance('config', config); injector.instance('db', db);
Use injector
injector.inject(function (Service1, db, config) { // this function will be called asynchronously after all required modules are initialized });
For more details take a look at provided testsuite. There are all possible use cases.