A simple promise-based library for NATS
Install via NPM:
npm install nats-promisify
const nats = require('nats-promisify');
nats.publish('k1', 'hello')
.then(console.log)
.catch(console.error);
nats.on('k1')
.then((data)=>console.log('message', data.msg))
.catch(console.error);
nats.emit('k2', 'hello')
.then((resp)=>console.log('response', resp))
.catch(console.error);
nats.on('k2')
.then((data)=>{
console.log('message', data.msg);
nats.publish(data.reply, 'good job!');
})
.catch(console.error);
If you encounter any bugs or issues, feel free to open an issue at github.
Copyright © 2019, Aram Manukyan.
All rights reserved.