hemera-parambulator

1.0.1 • Public • Published

Hemera-parambulator package

npm styled with prettier

This is a plugin to use Parambulator with Hemera.

We prefer to use Joi as a payload validator. The status quo of payload validation in NodeJs.

Example

const Hemera = require('./../')
const nats = require('nats').connect()
 
const hemera = new Hemera(nats, {
  logLevel: 'info'
})
 
hemera.use(require('hemera-parambulator'))
 
hemera.ready(() => {
 
  // Use Parambulator as payload validator
  hemera.setOption('payloadValidator', 'hemera-parambulator')
 
  /**
   * Your Implementations
   */
  hemera.add({
    topic: 'math',
    cmd: 'add',
    a: {
      type$: 'number'
    }
  }, (req, cb) => {
 
    cb(null, req.a + req.b)
  })
 
  hemera.act({
    topic: 'math',
    cmd: 'add',
    a: 'dwed3',
    b: 20
  }, function (err, resp) {
 
    this.log.info('Error', err)
  })
})

Pass the full schema

  hemera.add({
    topic: 'email',
    cmd: 'send',
    pb$: {
      a: {
        type$: 'number'
      }
    }
  }, (resp, cb) => {
 
  })

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
1.0.11latest

Version History

VersionDownloads (Last 7 Days)Published
1.0.11
1.0.00
0.2.20
0.2.10
0.2.00
0.1.920
0.1.910
0.1.900
0.1.890
0.1.880
0.1.870
0.1.860
0.1.850
0.1.840
0.1.830
0.1.820
0.1.810
0.1.800
0.1.790
0.1.780
0.1.770
0.1.760
0.1.750
0.1.740
0.1.730
0.1.720
0.1.710
0.1.700
0.1.690
0.1.680
0.1.670
0.1.660
0.1.650
0.1.640
0.1.630
0.1.620
0.1.610
0.1.600
0.1.590
0.1.580

Package Sidebar

Install

npm i hemera-parambulator

Weekly Downloads

1

Version

1.0.1

License

MIT

Last publish

Collaborators

  • starptech