Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
express-use-request
Advanced tools
This is a small library for the nodejs express server, based on the async-hooks mechanism. It allows you to receive the current processed request from anywhere.
#express-use-request
This is a small library for the nodejs express
server, based on the async-hooks
mechanism.
It allows you to receive the current processed request from anywhere.
npm i express-use-request
First you need to connect middleware
. It is recommended to connect it one of the first.
// index.js
let { middleware } = require('express-use-request');
let anyLib = require('./any-lib.js');
...
const app = express();
app.use(middleware);
app.get('/', (req, res) => {
/**
* There is no need passing req to anyMetod and to any nested deeper.
*/
let result = anyLib.anyMetod({foo: 'bar'});
res.status(200).send(result);
});
app.listen(3000);
With the useRequest
function, you can get the request to be processed anywhere.
It may contain supporting information related to a specific request, which now does not need to be passed through the entire callstack.
// ./any-lib.js
const { useRequest } = require('express-use-request);
module.exports = {
anyMethod: (params) => {
// With the useRequest function, you can access a request from anywhere.
let request = useRequest();
...
}
};
FAQs
This is a small library for the nodejs express server, based on the async-hooks mechanism. It allows you to receive the current processed request from anywhere.
The npm package express-use-request receives a total of 6 weekly downloads. As such, express-use-request popularity was classified as not popular.
We found that express-use-request demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.