Skip middleware when a path matches
npm install express-not
const not = require('express-not')
app.use('/mount',
not(['/skip'], (req, res) => res.send('stopped')),
(req, res) => res.send('skipped')
)
// GET /mount/skip => skipped
// GET /mount/other => stopped
not(path, middleware, [options])
:
path
: An Express path that should be skipped over. If the path of the request matches, the passedmiddleware
will be skipped. Supports any of Express Path Examples.middleware
: An Express callback or router, or an array of callbacks and/or routersoptions
:caseSensitive
: Enable case sensitivity when matching the route (express.Router docs), defaultfalse
strict
: Enable strict routing when matching the route (express.Router docs), defaultfalse
end
: Match the route completely (like.all
) instead of just the prefix (like.use
), defaultfalse
MIT