vodoun
A dependency injection framework for server-side node apps.
Last updated 3 years ago by tzrlk .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install vodoun 
SYNC missed versions from official npm registry.

= Vodoun

image:https://travis-ci.org/aetheric/vodoun.svg?branch=master["Build Status", link="https://travis-ci.org/aetheric/vodoun"] image:https://coveralls.io/repos/github/aetheric/vodoun/badge.svg?branch=master["Coverage Status", link="https://coveralls.io/github/aetheric/vodoun"] image:https://badge.fury.io/js/vodoun.svg["npm version", link="https://badge.fury.io/js/vodoun"]

A dependency injection framework for server-side node apps.

== Installation

npm install vodoun --save

== Usage

.src/main/service/service-a.js [source,javascript]

import vodoun from 'vodoun';

vodoun.register('service_a', [], (service) => {

let stateChanged = false;

service.blergh = () => {
	console.log('BLERGH!!!');
	stateChanged = true;
});

});

.src/main/service/service-b.js [source,javascript]

import vodoun from 'vodoun'; import dbLib from 'db-lib';

vodoun.register('service_b', [ 'service_a' ], (service) => {

const serviceA = this.service_a;

return dbLib.connect('prot://localhost:8260/dbname').then((conn) => {

	service.query = (query, params) => conn.query(query, params);

	service.close = () => conn.close().then(serviceA.blergh);

});

});

.src/main/service/service-c.js [source,javascript]

import vodoun from 'vodoun';

vodoun.register('service_c', { bloopyWibble: 'service_a', wibbledyBloob: 'service_b'

}, (service) => {

const serviceA = this.bloopyWibble;
const serviceB = this.wibbledyBloop;

service.argh = (query, params) => {
	serviceA.blergh();
	return serviceB.query(query, params).then((result) => serviceB.close());
});

});

.src/main/index.js [source,javascript]

import vodoun from 'vodoun';

vodoun.scan('src/main', '**/*.js').then((files) => { console.log(Vodoun scan complete. ${files.length} files loaded.); return vodoun.resolve('service_c');

}).then((serviceC) => { return serviceC.argh('get stuff from somewhere when something = :param', { param: 'value' });

});

Current Tags

  • 1.0.0-6-gb257685                                ...           latest (3 years ago)

9 Versions

  • 1.0.0-6-gb257685                                ...           3 years ago
  • 1.0.0-5-g14c5c0e                                ...           3 years ago
  • 1.0.0                                ...           4 years ago
  • 0.0.0-18-gee2c20b                                ...           4 years ago
  • 0.0.0-17-gd1d8edb                                ...           4 years ago
  • 0.0.0-12-g6f5fffa                                ...           4 years ago
  • 0.0.0-11-gf3445b9                                ...           4 years ago
  • 0.0.0-9-g47f74c5                                ...           4 years ago
  • 0.0.0-8-gef1f913                                ...           4 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 10
Dependencies (3)
Dev Dependencies (16)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |