0.0.2 • Published 7 years ago

auto_discovery v0.0.2

Weekly downloads
2
License
ISC
Repository
github
Last release
7 years ago

autoDiscoverySample

In microservice world, enable new services without changing configs on the existing services. No configuration, and auto discovery new services.

Requirement:

  • A Redis Server
  • Node.js (express)

How To:

AutoDiscovery_sample.js is a sample

  1. npm install -save auto_discovery
  2. In code: const AutoDiscovery = require('auto_discovery');
  3. Create an express server: express = require('express'); app = express(); PORT= 3000;
  4. Create an object contains the service info: myConfig = {name: NAME, content: {url: "http://localhost:3000", endpoints: {a: "/endpoint_a", b: "/endpoint_b", ...}}};
  5. Create redis info: redisUrl = "localhost"; redisPort = "6379";
  6. Create autoDiscovery Instance: AutoConfigs = new AutoDiscovery(myConfig, {url: redisUrl, port: redisPort}, {server: app, port: PORT}, null);

    Any services using the same Redis Server will be enable with auto-discovery feature. Save time for configuration management, extra deployments.