Skip to content

gtramontina/elysia-requestid

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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",
});

About

Elysia Request ID Plugin

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published