code-middleware

1.0.1 • Public • Published

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);
});

Dependencies (1)

Dev Dependencies (9)

Package Sidebar

Install

npm i code-middleware

Weekly Downloads

0

Version

1.0.1

License

MIT

Unpacked Size

97.3 kB

Total Files

8

Last publish

Collaborators

  • ls-master