Created
June 7, 2017 10:15
-
-
Save sharpred/6215e1867dc278a62530f610e8067116 to your computer and use it in GitHub Desktop.
webtask for dark skies api
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use latest' | |
module.exports = function (context, cb) { | |
var request = require("request"); | |
//37.8267 | |
//-122.4233 | |
var url = `https://api.darksky.net/forecast/${context.data.dsApiKey}/${context.data.latitude},${context.data.longitude}?exclude=%5Bminutely,daily,%20%20flags%5D?units=%5Buk2%5D`; | |
var options = { | |
method: 'GET', | |
url: url | |
}; | |
request(options, function (error, httpResponse, body) { | |
if (error) { | |
console.error(error); | |
cb("beh", null); | |
} | |
var obj = JSON.parse(body); | |
cb(null, body); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment