Express Http Context

screenshot of Express Http Context
express

Get and set request-scoped context anywhere

Overview

Express HTTP Context is an unopinionated and idiomatic ExpressJS implementation of cls-hooked, ideal for storing user state, JWT claims, request/correlation IDs, and other request-scoped data. It ensures that context is preserved even during async/await calls in Node.js versions 8 and higher.

Features

  • Request-Scoped Context: Store user state, JWT claims, request/correlation IDs, and other data uniquely for each request.
  • Preservation Over Async/Await: Ensures that context is maintained even during asynchronous operations.
  • Compatibility with ExpressJS Middleware: Can be easily integrated with other ExpressJS middleware for seamless functionality.

Summary

Express HTTP Context provides a convenient solution for managing request-scoped data in ExpressJS applications. By preserving context during asynchronous operations and offering seamless integration with other ExpressJS middleware, this package simplifies the handling of user state, JWT claims, and other request-specific information. Just keep in mind the compatibility notes for different Node.js versions to ensure optimal functionality.

express
Express

Express.js is a simple Node.js framework for single, multi-page, and hybrid web applications.