trainyard
v0.1.2
Published
A tiny train-themed amqplib wrapper
Downloads
2
Readme
Trainyard
A tiny train-themed amqplib wrapper
Examples
const { Trainyard, Railcar } = require("trainyard");
const trainyard = new Trainyard("amqp://justin:password@localhost");
(async function () {
await trainyard.connect();
console.log("Connected to Trainyard");
let data = {
status: 200,
message: "Hello World",
};
let payload = new Railcar()
.setData(data)
.setFormat(Railcar.formats.OBJECT)
.setDestination("world");
await trainyard.send(payload);
})();
const { Trainyard, Railcar } = require("trainyard");
const trainyard = new Trainyard("amqp://justin:password@localhost");
trainyard.connect().then(() => {
console.log("Connected to Trainyard");
trainyard.alight("world", async (message) => {
let payload = new Railcar()
.setData("Hello World")
.setFormat(Railcar.formats.STRING)
.setSecret(message.getSecret())
.setDestination("earth");
trainyard.send(payload);
});
});