Open XRIDER123 opened 4 months ago
const API_KEY = 'YOUR_API_KEY'; const API_URL = 'https://api.openweathermap.org/data/2.5/weather?q=';
async function fetchWeather(location) { try { const response = await fetch(${API_URL}${location}&appid=${API_KEY}&units=metric); const data = await response.json(); console.log(data); return data; } catch (error) { console.error('Error fetching weather data:', error); } }
${API_URL}${location}&appid=${API_KEY}&units=metric
const API_KEY = 'YOUR_API_KEY'; const API_URL = 'https://api.openweathermap.org/data/2.5/weather?q=';
async function fetchWeather(location) { try { const response = await fetch(
${API_URL}${location}&appid=${API_KEY}&units=metric
); const data = await response.json(); console.log(data); return data; } catch (error) { console.error('Error fetching weather data:', error); } }