2017-08-16 5 views
0

Chrome拡張機能Postmanを使用してBing APIエンドポイントに接続できました。
私はNodeJSとAWS Lambdaを初めて使用しています。 nodejs 6.9.0HTTPS get node getsを使用してBing APIに接続中に接続を拒否しました

Error: connect ECONNREFUSED 127.0.0.1:443 
at Object.exports._errnoException (util.js:1018:11) 
at exports._exceptionWithHostPort (util.js:1041:20) 
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1086:14) 

Code: 

exports.handler = (event, context, callback) => { 
var headers = { 
'Ocp-Apim-Subscription-Key': '******************', 
'Content-Type': 'application/json', 
}; 
var options = { 
url: 'https://api.cognitive.microsoft.com/bing/v5.0/search?     
&q=hello', 
method: 'GET', 
headers: headers, 
}; 
const https = require("https"); 
https.get(options); 
}; 

でAWSラムダ関数から接続中に以下のエラーを見ることはあなたがBingのAPIを使って検索するパッケージnode-bing-apiを必要とし、使用することができ、あなたの助け

答えて

0

を感謝しています。

var Bing = require('node-bing-api')({ accKey: "your-account-key" }); 

Bing.web("hello", function(error, res, body){ 
    console.log(body); 
}); 
+0

ありがとうございます!それは動作します! – user08152017

関連する問題