worker-middleware

1.0.3 • Public • Published

worker-middleware

const Worker = require("worker-middleware").Worker;
 
var w = new Worker();
w.do(function (context, next) {
  context.username = "John Doe";
  context.email = "john.doe@gmail.com";
  next();
});
w.do(function (context, next) {
  setTimeout(function () {
    context.verify_user = true;
    next();
  }, 2000);
});
w.run(function (context, err) {
  if (err) {
    return console.error(err);
  }
  console.log(context);
});

Installation

$ npm install worker-middleware --save

/worker-middleware/

    Package Sidebar

    Install

    npm i worker-middleware

    Weekly Downloads

    0

    Version

    1.0.3

    License

    ISC

    Last publish

    Collaborators

    • jaylim12