Gathering detailed insights and metrics for express-http-context
Gathering detailed insights and metrics for express-http-context
Gathering detailed insights and metrics for express-http-context
Gathering detailed insights and metrics for express-http-context
npm install express-http-context
Typescript
Module System
Min. Node Version
Node Version
NPM Version
99.7
Supply Chain
88.9
Quality
81.8
Maintenance
100
Vulnerability
100
License
JavaScript (100%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
306 Stars
119 Commits
27 Forks
10 Watchers
19 Branches
10 Contributors
Updated on Jul 03, 2025
Latest Version
2.0.1
Package Id
express-http-context@2.0.1
Unpacked Size
7.05 kB
Size
2.98 kB
File Count
6
NPM Version
10.9.2
Node Version
22.14.0
Published on
Apr 19, 2025
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
Get and set request-scoped context anywhere. This package is an unopinionated, zero-dependency, Express-idiomatic implementation of Node AsyncLocalStorage. It's a great place to store user state, claims from a JWT, request/correlation IDs, and any other request-scoped data.
Install: npm i express-http-context
Use the context middleware before the first middleware or handler that needs to have access to the context.
1import express from 'express'; 2import * as httpContext from 'express-http-context'; 3 4const app = express(); 5app.use(httpContext.middleware); 6// All code from here on has access to the same context for each request
Set values based on the incoming request:
1// Example authentication middleware 2app.use(async (req, res, next) => { 3 try { 4 // Get user from data on request 5 const bearer = req.get('Authorization'); 6 const user = await userService.getUser(bearer); 7 8 // Add user to the request-scoped context 9 httpContext.set('user', user); 10 11 return next(); 12 } catch (err) { 13 return next(err); 14 } 15});
Get them from code that doesn't have access to the express req
object:
1import * as httpContext from 'express-http-context'; 2 3// Somewhere deep in the Todo Service 4async function createTodoItem(title, content) { 5 // Get the user from the request-scoped context 6 const user = httpContext.get('user'); 7 8 await db.insert({ title, content, userId: user.id }); 9}
npm install --save express-http-context@0
npm install --save express-http-context@1
Interesting in contributing? Take a look at the Contributing Guidlines
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
no dangerous workflow patterns detected
Reason
8 commit(s) and 5 issue activity found in the last 90 days -- score normalized to 10
Reason
license file detected
Details
Reason
packaging workflow detected
Details
Reason
0 existing vulnerabilities detected
Reason
dependency not pinned by hash detected -- score normalized to 4
Details
Reason
Found 0/6 approved changesets -- score normalized to 0
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2025-07-07
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn Moreexpress-http-context2
Modern request-scoped storage support for Express.js based on Asynchronous Local Storage.
@oliverlockwood/express-http-context-intermediate-library
An intermediate library, which makes use of express-http-context, to demonstrate existence (or otherwise!) of a bug
express-http-context-no-leak
Get and set request-scoped context anywhere
@sliit-foss/express-http-context
A rework of the express-http-context package to use the new async_hooks API