simple-injector

0.0.2 • Public • Published

simple-injector

A simple DI moulde for Node.js

var co = require('co');
var Injector = require('simple-injector');
var injector = new Injector();
 
injector.set('config', {
  db: {
    //...
  }  
});
 
injector.set('db', function ($config) {
  //...
  return db;
});
 
// action
 
controller.thisIsAnAction = function *(next, $config, $db) {
  //...
  this.body = yield $db.query(/*...*/);
};

License

The MIT License.

Dependencies (1)

Dev Dependencies (0)

    Package Sidebar

    Install

    npm i simple-injector

    Weekly Downloads

    8

    Version

    0.0.2

    License

    MIT

    Last publish

    Collaborators

    • poying