1.0.2 • Published 2 years ago

express-gateway-registry v1.0.2

Weekly downloads
-
License
MIT
Repository
-
Last release
2 years ago

express-gateway-registry

LoopBack

Installation

Install GatewayServiceRegistryComponent using npm;

$ [npm install | yarn add] express-gateway-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-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:30001"
      }

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