/nano-ci-router

Command interface router

Primary LanguageJavaScriptMIT LicenseMIT

Gitter NPM version Build status Test coverage Dependency Status License Downloads

nano-ci-router

Command interface router module.

API

var CiRouter = require('nano-ci-router');

var ci = new CiRouter();

ci.install({
	'get': {
		'version': function (args, done) {
			done('5.0');
		},
		'file': function (args, done) {
			fs.readFile(Path.join(STORAGE, args.path), 'utf8', function (err, text) {
				return err || text;
			});
		}
	}
});

ci.exec('get version', function (v) {
	console.log(v);
});

ci.batch([ 'get version', 'get file', { path: 'README.md' } ], function (ver, text) {
	console.log(ver); // will print 5.0
	console.log(text); // will print README.md file content
});