mirror of
https://github.com/gethomepage/homepage.git
synced 2025-12-06 21:57:48 +01:00
Merge pull request #25 from AlexFullmoon/main
Added OpenWeatherMap widget.
This commit is contained in:
9
src/pages/api/widgets/openweathermap.js
Normal file
9
src/pages/api/widgets/openweathermap.js
Normal file
@@ -0,0 +1,9 @@
|
||||
import cachedFetch from "utils/cached-fetch";
|
||||
|
||||
export default async function handler(req, res) {
|
||||
const { lat, lon, apiKey, duration, units } = req.query;
|
||||
|
||||
const api_url = `https://api.openweathermap.org/data/2.5/weather?lat=${lat}&lon=${lon}&appid=${apiKey}&units=${units}`;
|
||||
|
||||
res.send(await cachedFetch(api_url, duration));
|
||||
}
|
||||
Reference in New Issue
Block a user