Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/gtramontina/elysia-requestid
Elysia Request ID Plugin
https://github.com/gtramontina/elysia-requestid
Last synced: about 1 month 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 (about 1 year ago)
- Default Branch: main
- Last Pushed: 2024-04-08T18:35:34.000Z (7 months ago)
- Last Synced: 2024-08-04T22:11:13.723Z (3 months ago)
- Language: TypeScript
- Size: 22.5 KB
- Stars: 6
- 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",
});
```