UNPKG

tezx

Version:

TezX is a modern, ultra-lightweight, and high-performance JavaScript framework built specifically for Bun. It provides a minimal yet powerful API, seamless environment management, and a high-concurrency HTTP engine for building fast, scalable web applicat

11 lines (10 loc) 415 B
import { generateUUID } from "../helper/index.js"; const requestID = (headerName = "X-Request-ID", contextKey = "requestID") => { return function requestID(ctx, next) { let requestId = ctx.headers.get(headerName) ?? `req-${generateUUID()}`; ctx[contextKey] = requestId; ctx.headers.set(headerName, requestId); return next(); }; }; export { requestID as default, requestID };