Miss any of our Open RFC calls?Watch the recordings here! »

identify-consumer

1.0.1 • Public • Published

identify-consumer

Express middleware to help you identify who is using your endpoints

Installation

npm install identify-consumer

Usage

const identifyConsumer = require('identify-consumer');
// ...
 
const app = express();
app.use(identifyConsumer({
  consumerCallback: (consumer, req) => {
    // do something with this information, e.g. save it to a DB
    // req = the express request object
  },
  noConsumerCallback: (req) => {
    // do something to record consumers who do not identify themselves
    // req = the express request object
  },
  strict: true, // defaults to false, will return a 400 if no consumer is specified
});

Install

npm i identify-consumer

DownloadsWeekly Downloads

0

Version

1.0.1

License

MIT

Unpacked Size

5.66 kB

Total Files

4

Last publish

Collaborators

  • avatar