Merge pull request #25 from AlexFullmoon/main

Added OpenWeatherMap widget.
This commit is contained in:
Ben Phelps 2022-08-27 15:13:27 +03:00 committed by GitHub
commit dc6b172df9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 479 additions and 0 deletions

View 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));
}