3.0.0 • Published 1 year ago
express-not v3.0.0
express-not
Skip middleware when a path matches
This package works with Express v5. For Express v4 support, use express-not@2.
Install
npm install express-not
Usage
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 => stoppedDocumentation
not(path, [options], ...middleware):
path: An Express path that should be skipped over. If the path of the request matches, the passedmiddlewarewill be skipped. Supports any of Express Path Examples.options:caseSensitive: Enable case sensitivity when matching the route (express.Router docs), defaultfalsestrict: Enable strict routing when matching the route (express.Router docs), defaultfalsematchToEnd: Match the route completely (like.all) instead of just the prefix (like.use), defaultfalse
middleware: An Express callback or router, an array of callbacks and/or routers, or a mix of these
The v1 documentation is here.
Development
yarn
yarn build
yarn testLicense
MIT