2.5.0 • Published 12 months ago

express-gateway-service-registry v2.5.0

Weekly downloads
-
License
MIT
Repository
-
Last release
12 months ago

express-gateway-service-registry

Installation

Install GatewayServiceRegistryComponent using npm;

$ [npm install | yarn add] express-gateway-service-registry

Basic Use

Configure and load GatewayServiceRegistryComponent in the application constructor as shown below.

import {GatewayServiceRegistryComponent, Config,GatewayServiceRegistryComponentOptions, DEFAULT_SERVICE_REGISTRY_OPTIONS} from 'express-gateway-service-registry';
// ...
export class MyApplication extends BootMixin(ServiceMixin(RepositoryMixin(RestApplication))) {
  constructor(options: ApplicationConfig = {}) {
    const opts: GatewayServiceRegistryComponentOptions = DEFAULT_SERVICE_REGISTRY_OPTIONS;
    this.configure(GatewayServiceRegistryComponentBindings.COMPONENT).to(opts);
      // Put the configuration options here
    });

    this.bind<Config>(GatewayServiceRegistryComponentBindings.CONFIG).to({

      name: "test-micro",
      path: "/test-micro/*",
      host: "srv.mydomain.com",
      backend: {
        url: "http://localhost:3001"
      }

    });
    this.component(GatewayServiceRegistryComponent);
    // ...
  }
  // ...
}