simple-injector
v0.0.2
Published
simple-injector ---------------
Downloads
7
Readme
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.