0.0.2 • Published 10 years ago
simple-injector v0.0.2
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.