![](/img/trans.png)
[英]Create new document in IBM Watson Discovery Service with Watson Developer Cloud Node SDK
[英]watson discovery service always connecting to default service
我已經通過以下鏈接編輯了代碼
https://github.com/watson-developer-cloud/discovery-nodejs
我更改了環境變量以及發現服務用戶名和密碼。
但是在運行代碼時,它始終會使用默認服務(在上面的鏈接中指定的默認服務)而不是我的特定發現服務。 默認服務
取決於默認服務的含義。 如果您正在談論服務端點,則在實例化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(',')}]` }
});
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.