How to use nacos - 1 common examples

To help you get started, we’ve selected a few nacos examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github midwayjs / midway-examples / demo-nacos / src / service / namingService.ts View on Github external
async init() {
    this.nacosClient = new NacosNamingClient({
      ...this.nacosConfig,
      logger: this.logger,
      namespace: 'public',
    });
    await this.nacosClient.ready();

    // 这里的服务名请从 nacos 服务上找
    this.nacosClient.subscribe('nacos.test.3', hosts => {
      console.log('-----------naming result start --------------');
      console.log(hosts);
      console.log('-----------naming result end--------------');
    });
  }

nacos

nacos client main package

Apache-2.0
Latest version published 4 months ago

Package Health Score

68 / 100
Full package analysis

Popular nacos functions