0.0.2 • Published 4 years ago
async-cs v0.0.2
Asynchronous client server communication library based on RabbitMQ.
install
yarn add async-cs
server side
const { createConnection, register } = require('async-cs');
const connection = await createConnection('localhost');
register(connection, "service/add", (req, res) => {
const { a, b } = req;
res({ result: a + b });
});
client side
const { createConnection, request } = require('async-cs');
const connection = await createConnection('localhost');
let res = await request(connection, "service/add", { a: 3, b: 5 });
console.log(res) //res : { result: 8 }