Untitled
Now i know how to use weather apiconst url= 'https://weather-by-api-ninjas.p.rapidapi.com/v1/weather?city=Seattle'; const options = { method: 'GET', headers: { 'X-RapidAPI-Key': '7f8105a7f9mshff750c4c55fbe7ep1b7cb5jsne88d6e30b7c0', 'X-RapidAPI-Host': 'weather-by-api-ninjas.p.rapidapi.com' } }; async function checkWeather() { try{ const response = await fetch(url, options); const result = await response.text(); console.log(result); } catch (error){ console.error(error); } } checkWeather(); // FUnction should be called after users click submit button on frontend
Leave a Comment