Created
September 29, 2021 07:43
-
-
Save fredriccliver/01d7ec633a5a87bc1f53b4d10130923b 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
var weatherApiKey = "YOUR API KEY" | |
var destinationUrl = (cityName) => { | |
return `http://api.openweathermap.org/data/2.5/weather?q=${cityName}&appid=${weatherApiKey}` | |
} | |
fetch(destinationUrl(city)) | |
.then((response) => response.json()) | |
.then((data) => { | |
console.log(data) | |
resolve(data) | |
}) | |
.catch((error) => { | |
reject(error) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment