https://github.com/gtramontina/elysia-requestid
Elysia Request ID Plugin
https://github.com/gtramontina/elysia-requestid
Last synced: about 16 hours ago
JSON representation
Elysia Request ID Plugin
- Host: GitHub
- URL: https://github.com/gtramontina/elysia-requestid
- Owner: gtramontina
- License: mit
- Created: 2023-09-19T10:07:12.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-04-08T18:35:34.000Z (11 months ago)
- Last Synced: 2025-02-20T19:21:41.039Z (about 22 hours ago)
- Language: TypeScript
- Size: 22.5 KB
- Stars: 8
- Watchers: 2
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: readme.md
- License: license
Awesome Lists containing this project
- awesome-elysia - Request ID - Adds/Forwards request IDs (`X-Request-ID` or custom). (Plugins)
README
# Elysia Request ID
Elysia plugin to create or forward Request IDs.
## Installation
```bash
bun add --exact elysia-requestid
```## Usage
```ts
import { requestID } from "elysia-requestid"; // 1. Import
import Elysia from "elysia";new Elysia()
.use(requestID()) // 2. Use
.get("/", ({ requestID }) => {
return `Hello ${requestID}`; // 3. Available in Context
})
.listen(3000);
```## Options (with defaults)
```ts
requestID({
// The function to use to generate a request ID
uuid: crypto.randomUUID,// The header to use for the request ID
header: "X-Request-ID",
});
```