Seneca plugin providing a Promise-based API.
This is an interim plugin to provide a Promise-based API to Seneca.
NOTE: no longer provides a Promises API for entities, as seneca-entity 18.x+ provides this directly.
This open source module is sponsored and supported by Voxgig. |
---|
const Seneca = require('seneca')
var seneca = Seneca()
// Callback version: seneca.add(msg, action)
// Define a message patter and action
seneca.message('a:1', async function(msg) {
return {foo:1} // reply by just returning
})
// Callback version: seneca.act(msg, callback)
// Send a synchronous message action and wait for a reply
var reply = await seneca.post('a:1')