1
2
3
4
5
6
7
8
export async function getCurrentWeather(latitude = 0, longitude = 0) {
const pointsResponse = await fetch(`https://api.weather.gov/points/${latitude},${longitude}`),
{ properties: { forecastHourly } } = await pointsResponse.json(),
forecastResponse = await fetch(forecastHourly),
{ properties: { periods } } = await forecastResponse.json();
return periods[0];
}
Val Town is a social website to write and deploy JavaScript.
Build APIs and schedule functions from your browser.
Comments
Nobody has commented on this val yet: be the first!
February 1, 2024