Asynchronous dependency injector for Node.js
JavaScript
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lib
test
.gitignore
.travis.yml
.vimrc.local
LICENSE
README.md
index.js
package.json

README.md

ajector

Asynchronous dependency injector.

Build Status

npm install ajector

Usage

  1. Write modules

    // services/Service1.js
    module.exports = function () {
     return {};
    };
  2. Setup injector

    var ajector = require('ajector');
    
    var injector = ajector(__dirname + '/services');
    injector.instance('config', config);
    injector.instance('db', db);
  3. 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.