feat(api): weather endpoint
This commit is contained in:
parent
c9ef692c9a
commit
4593298fce
1 changed files with 15 additions and 0 deletions
15
src/routes/api/weather/+server.ts
Normal file
15
src/routes/api/weather/+server.ts
Normal file
|
|
@ -0,0 +1,15 @@
|
||||||
|
import fetchWeather from "$lib/clients/weather";
|
||||||
|
import { json } from "@sveltejs/kit";
|
||||||
|
|
||||||
|
// NOTE: Magnitogorsk, Russian Federation
|
||||||
|
const WEATHER_LAT = 53.40716;
|
||||||
|
const WEATHER_LON = 58.980289;
|
||||||
|
|
||||||
|
export async function GET() {
|
||||||
|
return json(
|
||||||
|
await fetchWeather(WEATHER_LAT, WEATHER_LON),
|
||||||
|
{
|
||||||
|
headers: new Headers({ 'cache-control': 'max-age=600' }),
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue