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
$ npm install --save swint-middleware
dir
:String
, default:path.dirname(require.main.filename)
walkOption
:Object
, default:{ ext: 'js' }
var middlewares = loader({
dir: path.join(__dirname, 'middlewares')
}); // { middlewareA: [Function], middlewareB: [Function], ... }
app.use(myMiddleware(options));
myMiddleware()
(notmyMiddleware
itself) gets three arguments, which isreq
,res
,next
.