1.0.1 • Published 5 years ago

code-middleware v1.0.1

Weekly downloads
4
License
MIT
Repository
github
Last release
5 years ago

Code Middleware

Purpose

Manage your code block use middleware model.

Useage

  • Install
npm i code-middleware --save
  • Use
const Router = require('code-middleware').default;
let router = new Router();
router.use('/test/output0', function(next){
    this.text += 0;
    console.log(0);
    next();
});
router.use('/test/output1', function(next){
    this.text += 1;
    console.log(1);
    next();
});
router.use('/test/output2', function(next){
    this.text += 2;
    console.log(2);
    next();
});
router.send({
    whiteList: ['/test'],
    blackList: ['/test/output1'],
    text: ''
}).then(function(context) {
    console.log(context.text);
});