Watson发现服务始终连接到默认服务

时间:2017-06-21 12:43:12

标签: node.js ibm-cloud watson-discovery

我已经编辑了以下链接中的代码

https://github.com/watson-developer-cloud/discovery-nodejs

我更改了环境变量和发现服务用户名和密码。

但是在运行代码时,它总是转到默认服务(在上面的链接中指定的服务)而不是我的特定发现服务。 Default service

1 个答案:

答案 0 :(得分:0)

取决于默认服务的含义。如果您正在讨论服务端点,那么在实例化DiscoveryV1类时,在app.js文件中为您正在使用的端点添加url说明符。

const discovery = new DiscoveryV1({
  // If unspecified here, the DISCOVERY_USERNAME and
  // DISCOVERY_PASSWORD env properties will be checked
  // After that, the SDK will fall back to the bluemix-provided VCAP_SERVICES environment property
  // username: '<username>',
  // password: '<password>',
  version_date: '2016-11-09',
  url: '<endpoint>',
  qs: { aggregation: `[${queryBuilder.aggregations.join(',')}]` }
});
相关问题