ant-demux
A demultiplexor API + Express Middleware connector
Last updated 6 years ago by scukerman .
AII · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install ant-demux 
SYNC missed versions from official npm registry.

ant-demux

A demultiplexor API + Express Middleware connector

Demo:

var Demux = require('ant-demux');
var express = require('express');
var bodyParser = require('body-parser');
var app = express();

app.use(bodyParser.json());
app.use(function (error, req, res, next) {
	if(error.message === 'invalid json')
		return res.send('Bad request: JSON was expected.');
	next();
});

var frontendApi = new Demux({
	actions: {
		'namespace': {
			'method1': function() {
				return 'method1: test';
			}
		}
	}
});
frontendApi.addAction('namespace.method2', function(request) {
	return "Method2: that's ok too";
});

app.use(frontendApi.connector());

app.listen(3000, function() {
	console.log('Started at 3000');
});

Current Tags

  • 1.0.2                                ...           latest (6 years ago)

3 Versions

  • 1.0.2                                ...           6 years ago
  • 1.0.1                                ...           6 years ago
  • 1.0.0                                ...           6 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (3)
Dev Dependencies (0)
None
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |