Code Explainers

Code explainers tagged #async-local-storage

javascript
const express = require('express');
const { AsyncLocalStorage } = require('async_hooks');
const { randomUUID } = require('crypto');
 

Per-request logging context in Express

async-local-storage middleware structured-logging
Advanced 8 steps
typescript
import { AsyncLocalStorage } from 'node:async_hooks';
import { randomUUID } from 'node:crypto';
import { Injectable, NestMiddleware } from '@nestjs/common';
import { Request, Response, NextFunction } from 'express';

Request correlation IDs in NestJS with AsyncLocalStorage

async-local-storage middleware logging
Advanced 8 steps