micro-service

0.0.4 • Public • Published

micro-service

Build Status npm Github Releases

API

register

const MicroService = require('micro-service');
const client = new MicroService({
    key: 'backend',
    host: '127.0.0.1',
    port: 2379
});
 
client.set({
    ip: '192.168.1.1',
    port: 80,
    host: 'test.com',
    prefix: '/albi'
});
client.ttl(600);
client.addTag('http-backend', 'app-albi', 'http-ping');
client.register();

list

const MicroService = require('micro-service');
const client = new MicroService({
    key: 'backend',
    host: '127.0.0.1',
    port: 2379
});
client.list('backend:http').then(data => {
    console.info(data);
});

refresh

const MicroService = require('micro-service');
const client = new MicroService({
    key: 'backend',
    host: '127.0.0.1',
    port: 2379
});
 
client.set({
    ip: '192.168.1.1',
    port: 80,
    host: 'test.com',
    prefix: '/albi'
});
client.ttl(600);
client.addTag('http-backend', 'app-albi', 'http-ping');
client.register();
setTimeout(() => {
    client.refresh();
}, 60 * 1000);

License

MIT

Readme

Keywords

Package Sidebar

Install

npm i micro-service

Weekly Downloads

1

Version

0.0.4

License

MIT

Last publish

Collaborators

  • tree.xie