Update to API v3

openweathermap deprecated API version 2.5; 3.0 should be a drop-in replacement:

https://openweathermap.org/one-call-transfer
This commit is contained in:
Joseph N Denton
2024-09-20 12:29:12 -07:00
committed by GitHub
parent 581828d49a
commit 6a3233d14f

View File

@@ -24,7 +24,7 @@ export default async function handler(req, res) {
return res.status(400).json({ error: "Missing API key" });
}
const apiUrl = `https://api.openweathermap.org/data/2.5/weather?lat=${latitude}&lon=${longitude}&appid=${apiKey}&units=${units}&lang=${lang}`;
const apiUrl = `https://api.openweathermap.org/data/3.0/weather?lat=${latitude}&lon=${longitude}&appid=${apiKey}&units=${units}&lang=${lang}`;
return res.send(await cachedFetch(apiUrl, cache));
}