api-pass

1.3.1 • Public • Published

api-pass

Installation

npm install api-pass

Usage

apiPass = require('api-pass');

app.get('/api/pass', function (req, res, next) {
  req.apiPass = true;
  next();
});

app.get('/api/deny', function (req, res, next) {
  req.apiPass = false;
  next();
});

app.get('/api/404', function (req, res, next) {
  next();
});

app.use('/api', apiPass('http://you-resource-server/and-path-prefix'));

Now visit /api/pass, it will be reverse proxy to http://you-resource-server/and-path-prefix/pass, /api/deny will response a 403, and /api/404 will pass the apiPass() middleware since req.apiPass is ommited.

Dependencies (3)

Dev Dependencies (6)

Package Sidebar

Install

npm i api-pass

Weekly Downloads

6

Version

1.3.1

License

MIT

Last publish

Collaborators

  • undozen