1
2
3
4
5
6
7
8
9
10
import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=41";
// Currently broken! Val.Town cannot fetch from .gov sites
// You can get these input values by calling https://api.weather.gov/points/{latitude},{longitude}
export async function getWeatherGovData({ office, gridX, gridY }) {
const data = await fetchJSON(
`https://api.weather.gov/gridpoints/${office}/${gridX},${gridY}/forecast`
);
return data.properties;
}
👆 This is a val. Vals are TypeScript snippets of code, written in the browser and run on our servers. Create scheduled functions, email yourself, and persist small pieces of data — all from the browser.