Security News
Maven Central Adds Sigstore Signature Validation
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.
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')();
var senecaContext = require('seneca-context');
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(senecaContext.setContextPlugin);
// Adds the `context$` property to the incoming messages matching the `pin`.
seneca.use(senecaContext.getContextPlugin, {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
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.
Security News
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
Research
Security News
Socket researchers uncovered a backdoored typosquat of BoltDB in the Go ecosystem, exploiting Go Module Proxy caching to persist undetected for years.