v50-hemera-loaderdeprecated

Wrapper for hemera.js to load hemera object or spawn independent node process for hemera.js

Usage no npm install needed!

<script type="module">
  import v50HemeraLoader from 'https://cdn.skypack.dev/v50-hemera-loader';
</script>

README

v50-hemera-loader (ES6, ALFA)

v50-hemera-loader wrapper to load hemera object or spawn hemera detached process.

Installation

npm -i --save v50-hemera-loader

API Reference

createHemera((err, hemera) => {
    hemere // Hemera Object
})

createHemera(hemeraOptions, natsOptions, (err, hemera) => {
    hemere // Hemera Object
})
// './test/executeModule.js'
module.exports = hemera => {
    hemera.add({topic: 'math', cmd: 'add'}, (req, res) => {
        return res(null, true)
    })
}

const uncaughtException = error => {
    throw new Error(error)
}

// Spawn detached node process with hemera
createHemeraInstance(resolve('./test/executeModule.js'), uncaughtException, (err, node) => {
    node.kill()
})

createHemeraInstance(resolve('./test/executeModule.js'), hemeraOptions, natsOptions, uncaughtException, (err, node) => {
    node.kill()
})

For more examples see tests

Tests

npm test

Contributors

Edgars Mjasnikovs

License

MIT