this morning, i also had the same doubt and now its cleared i had just used JSON with 'open-weather-map'(https://openweathermap.org/) api and got data from the URL in the index.html file, the code looks like this:-
//got location_x000D_
var x = document.getElementById("demo");_x000D_
if (navigator.geolocation) {_x000D_
navigator.geolocation.getCurrentPosition(weatherdata);_x000D_
} else { _x000D_
x.innerHTML = "Geolocation is not supported by this browser.";_x000D_
}_x000D_
//fetch openweather map url with api key_x000D_
function weatherdata(position) {_x000D_
//put corrdinates to get weather data of that location_x000D_
fetch('https://api.openweathermap.org/data/2.5/weather?lat='+position.coords.latitude+'&lon='+position.coords.longitude+'&appid=b2c336bb5abf01acc0bbb8947211fbc6')_x000D_
.then(response => response.json())_x000D_
.then(data => {_x000D_
console.log(data);_x000D_
document.getElementById("demo").innerHTML = _x000D_
'<br>wind speed:-'+data.wind.speed + _x000D_
'<br>humidity :-'+data.main.humidity + _x000D_
'<br>temprature :-'+data.main.temp _x000D_
});_x000D_
}
_x000D_
<div id="demo"></div>
_x000D_
i had give api key openly because i had free subscription, just have a free subscriptions in beginning. you can find some good free api's and keys at "rapidapi.com"