1.0.11 • Published 1 year ago

@relab/fastify-correlation-id v1.0.11

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

@relab/fastify-correlation-id

Fastify plugin to store and retrieve correlation IDs.

The plugin retrieves the X-Correlation-ID header (or any other desired header) from the request and makes it accessible throughout the application code. It also propagates the header to the response.

Requirements

  • Node 18+
  • Fastify 4+

Installation

NPM

npm install --save @relab/fastify-correlation-id

PNPM

pnpm add @relab/fastify-correlation-id

Usage

import Fastify from 'fastify'
import { CorrelationId } from '@relab/fastify-correlation-id'

const fastify = Fastify()
    .register(CorrelationId, {
        header: 'X-Correlation-ID', // optional
        skipResponseHeader: true, // optional
    })

Configuration

There are some environment variables used to configure logger.

OptionDescriptionDefault
headerHeader name for correlation ID.X-Correlation-ID
skipResponseHeaderIf set to true, it will not propagate correlation ID to response header.false

License

Released under MIT by Sergey Zwezdin.

1.0.11

1 year ago

1.0.10

1 year ago

1.0.9

1 year ago

1.0.8

1 year ago

1.0.7

1 year ago

1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago