2.1.0 • Published 3 years ago

express-not v2.1.0

Weekly downloads
29
License
MIT
Repository
github
Last release
3 years ago

express-not

Skip middleware when a path matches

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 => stopped

Documentation

not(path, [options], ...middleware):

  • path: An Express path that should be skipped over. If the path of the request matches, the passed middleware will be skipped. Supports any of Express Path Examples.
  • options:
    • caseSensitive: Enable case sensitivity when matching the route (express.Router docs), default false
    • strict: Enable strict routing when matching the route (express.Router docs), default false
    • matchToEnd: Match the route completely (like .all) instead of just the prefix (like .use), default false
  • 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 test

License

MIT

2.1.0

3 years ago

2.0.2

4 years ago

2.0.1

4 years ago

2.0.0

4 years ago

1.1.0

4 years ago

1.0.0

4 years ago