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.

Readme

Keywords

none

Package Sidebar

Install

npm i simple-injector

Weekly Downloads

1

Version

0.0.2

License

MIT

Last publish

Collaborators

  • poying