I’m currently trying to work with the Bing Search API using it in React but the Bing API formatting is different from other API’s I’ve used that have required a key. This one requires a key as well but its called a subscription key the way it is set up in Node is
let bing_web_search = function (search) { console.log('Searching the Web for: ' + term); let request_params = { method : 'GET', hostname : host, path : path + '?q=' + encodeURIComponent(search), headers : { 'Ocp-Apim-Subscription-Key' : subscriptionKey, } }; let req = https.request(request_params, response_handler); req.end(); }
The above example variables like host, subscriptionKey are all defined above and this works in node but when I try doing something similar with react it doesn’t work. I’ve gone through multiple API react tutorials but I just can’t seem to figure it out.
To be fair I’ve only worked with the NYTimes API with React which is pretty straight forward. If anyone could help that would be awesome.