seneca.add({role:'api', cmd:'ping'}, function(args, cb) {
var actualargs = seneca.util.argprops({}, args, {}, 'role, cmd')
})
argprops signature: argprops(defaults, args, fixed, omit) defaults, args, and fixed are deepextended together in that order
seneca.clean(obj)
seneca.add({role:'api', cmd:'ping'}, function(args, cb) {
var seneca = this;
})
seneca.add({role:’api’, end: 'end'}, function(args, done) {
done(null, {httpstatus$:400, ...})
})
entobj.data$()
or
_.omit(entobj.data$(), ['entity$']
to also remove the entity$ field
entobj1.parent = entobj2
entobj1.parent will be persisted (automagically) as entobj2.id on save$
seneca.util.deepextend(obj, [sources])
Useful for extending options.
seneca.options()
If action handlers are registered for the same pattern multiple times, it’s only the last one that will get invoked. The previously registered action handler can be called via this.prior from the overriding handler:
seneca.add({cmd: ‘load’}, function(args, done) {
... // first handler
})
seneca.add({cmd: ‘load’}, function(args, done) {
this.prior(args, done) // second handler calling first handler
})
Avoid writing actions that take a long time to execute. Or otherwise you need to override the default seneca timeout.