Created
August 8, 2018 15:02
-
-
Save htunnicliff/d6369ac8ba83d7259a8504740b1b06fa to your computer and use it in GitHub Desktop.
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
async function weather(key, ...args) { | |
const url = `https://api.darksky.net/forecast/${key}/` + args.join(',') | |
const config = { | |
credentials: "same-origin", | |
mode: 'no-cors', | |
method: "GET", | |
headers: { | |
'Accept': 'application/json' | |
} | |
} | |
console.log(`Querying "${url}"`) | |
try { | |
const json = await fetch(url, config).then(res => res.json()) | |
return json | |
} catch (err) { | |
console.log(err) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment