1.0.1 • Published 7 years ago

restify-correlation-id v1.0.1

Weekly downloads
4
License
MIT
Repository
github
Last release
7 years ago

Build Status npm version

restify-correlation-id

A restify plugin to track correlation IDs across API requests

Correlation IDs (sometimes called "trace IDs") are unique identifiers that track a request through a series of API calls.

This middleware parses incoming headers for a set correlation ID and stores it away on the req object. If no appropriate headers are sent with the request, a new ID is created instead.

Usage

const restify = require('restify'),
  { cid } = require('restify-correlation-id');

let server = restify.createServer();
server.use(correlationId());

server.get('/', (req, res, next) => {
  res.send(req.cid);
  next();
});

server.listen(8080, () => {
  console.log('I echo correlation IDs!');
});

Option

{
  header: 'CorrelationID'
}

header

The name of the header to parse a correlation ID from. Parsing is case-insensitive. The default header field is "CorrelationID".

License

MIT

1.0.1

7 years ago

1.0.0

7 years ago

0.0.2

7 years ago

0.0.1

7 years ago