Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ivanvs/nest-request-id
https://github.com/ivanvs/nest-request-id
Last synced: 1 day ago
JSON representation
- Host: GitHub
- URL: https://github.com/ivanvs/nest-request-id
- Owner: ivanvs
- License: mit
- Created: 2023-05-02T14:55:43.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-05-23T17:16:29.000Z (over 1 year ago)
- Last Synced: 2024-11-12T20:02:32.652Z (3 days ago)
- Language: TypeScript
- Size: 62.5 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[![npm](https://img.shields.io/npm/dt/nest-request-id.svg)](https://img.shields.io/npm/dt/nest-request-id.svg)
[![npm version](https://badge.fury.io/js/nest-request-id.svg)](https://badge.fury.io/js/nest-request-id)
![License](https://img.shields.io/badge/license-MIT-blue.svg)# nest-request-id
RequestID middleware for Nest.js that adds an indentifier to the request and response.
## Installation
Run `npm i nest-request-id`
## Example
```
import { Module, NestModule, MiddlewareConsumer } from '@nestjs/common';
import { RequestIdMiddleware } from 'nest-request-id';
import { CatsModule } from './cats/cats.module';@Module({
imports: [CatsModule],
})
export class AppModule implements NestModule {
configure(consumer: MiddlewareConsumer) {
consumer
.apply(RequestIdMiddleware)
.forRoutes('cats');
}
}
```## License
[MIT License](https://opensource.org/licenses/MIT) © Ivan Vasiljevic