elysia-requestid
v1.0.9
Published
Elysia Request ID Plugin
Downloads
2,663
Readme
Elysia Request ID
Elysia plugin to create or forward Request IDs.
Installation
bun add --exact elysia-requestid
Usage
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)
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",
});