node-consul
node-consul copied to clipboard
how to watch service?
I believe you already figured out this but still I think this should work for you
const consul = new Consul({})
const watch = consul.watch({
method: consul.health.service,
options: {
service: "service-name",
tag: "dev",
},
});
watch.on("change", data => {
console.log(data)
});
watch.on("error", err => {
console.log(err);
});