Security News
UK Officials Consider Banning Ransomware Payments from Public Entities
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.
seneca-context
Advanced tools
Generate a context object based on an HTTP request and easily access it any seneca services involved in processing that request.
Generate a context object based on an HTTP request and easily access it any seneca services involved in processing of that request.
npm install --save seneca-context
See also the example
and test
directories.
var seneca = require('seneca')();
seneca.add('role:api,path:work', function (message, done) {
// context is implicitly propagated to the next seneca action
this.act('role:worker,cmd:work', done);
});
seneca.add('role:worker,cmd:work', function (message, done) {
// context is accessible at the `context$` property of the message
done(null, message.context$);
});
// Creates the context from HTTP requests and propagates it to all actions within the transaction.
seneca.use('seneca-context/plugins/setContext');
// Adds the `context$` property to the incoming messages matching the `pin`.
seneca.use('seneca-context/plugins/getContext', {pin: 'role:worker'});
seneca.act('role:web', {
use: {
prefix: '/api',
pin: 'role:api,path:*',
map: {
work: {GET: true}
}
}
});
// start express
var app = require('express')();
app.use(require('body-parser').json());
app.use(seneca.export('web'));
app.listen(3000);
Test that it works.
curl -m 1 -H 'X-Request-Id: hello-world' http://localhost:3000/api/work
TODO
For now, see comments in index.js
FAQs
Generate a context object based on an HTTP request and easily access it any seneca services involved in processing that request.
The npm package seneca-context receives a total of 0 weekly downloads. As such, seneca-context popularity was classified as not popular.
We found that seneca-context demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers 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
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.
Security News
Snyk's use of malicious npm packages for research raises ethical concerns, highlighting risks in public deployment, data exfiltration, and unauthorized testing.
Research
Security News
Socket researchers found several malicious npm packages typosquatting Chalk and Chokidar, targeting Node.js developers with kill switches and data theft.