Skip to content

coder-on-deck/bamba

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

middle

uses syntax similar to express middlewares, but outside the context of webapps

Installation

npm i bamba

Usage Example

var bamba = require('bamba')

bamba(function (context, next) {
  // do something with context

  next(); // call next when you're done. alternatively, return a promise
}, function (context, next) {
  // modifications on context are available in the next function

  if ( context.error ){
     next('got an error'); // pass error. this will reach the next function with error
  } else {
    next(); // simply moves to next function
  }
}, function( context, next ){
    // if the previous function passed an error, we will skip this one
    next();
},function (err, context, next) {
    // this function will be invoked if there was an error, and if there was no error
    // it allows you to handle the error and move on
}, ... )


About

allows using express middleware like syntax outside webapp context

Resources

Stars

Watchers

Forks

Packages

No packages published