mirror of
https://github.com/DI0IK/homepage-plus.git
synced 2025-07-13 00:18:50 +00:00
Added OpenWeatherMap widget.
This commit is contained in:
parent
f0f470ba8b
commit
6a97d392c9
6 changed files with 482 additions and 0 deletions
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 } = req.query;
|
||||
|
||||
const api_url = `https://api.openweathermap.org/data/2.5/weather?lat=${lat}&lon=${lon}&appid=${apiKey}`;
|
||||
|
||||
res.send(await cachedFetch(api_url, duration));
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue