swint-middleware
Essential expressJS middlewares and general middleware loader for Swint
Warning: This is not the final draft yet, so do not use this until its official version is launched
Installation
$ npm install --save swint-middleware
Loader
Options
-
dir
:String
, default:path.dirname(require.main.filename)
-
walkOption
:Object
, default:{ ext: 'js' }
Usage
var middlewares = loader({
dir: path.join(__dirname, 'middlewares')
}); // { middlewareA: [Function], middlewareB: [Function], ... }
Middlewares
Usage
app.use(myMiddleware(options));
-
myMiddleware()
(notmyMiddleware
itself) gets three arguments, which isreq
,res
,next
.