From eb8856e827e6b87245b7cf34ffb063971829b072 Mon Sep 17 00:00:00 2001 From: Jee Manghani Date: Fri, 29 Mar 2019 00:48:28 -0700 Subject: [PATCH] Use proxy to get CORS data --- node_helper.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/node_helper.js b/node_helper.js index 84f68c0..dd814e7 100644 --- a/node_helper.js +++ b/node_helper.js @@ -41,15 +41,15 @@ module.exports = NodeHelper.create({ } else { //make request to Dark Sky API - var url = "https://api.darksky.net/forecast/" + + var url = "https://cors-anywhere.herokuapp.com/https://api.darksky.net/forecast/" + + //var url = "https://api.darksky.net/forecast/" + payload.apikey + "/" + payload.latitude + "," + payload.longitude + "?units=" + payload.units + "&lang=" + payload.language; // "&exclude=minutely" - // console.log("[MMM-DarkSkyForecast] Getting data: " + url); - request({url: url, method: "GET"}, function( error, response, body) { + request({url: url, method: "GET", headers:{'Origin':'http://manghani.com'}}, function( error, response, body) { if(!error && response.statusCode == 200) {