1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import { fetch } from "https://esm.town/v/std/fetch";
// https://www.schools.nyc.gov/docs/default-source/school-menus/2023-2024/september/pre-k---8-express-hot-lunch-menu
//
export let fetchDOEMenu: (opts: {schoolYear: `${number}-${number}`, month: string, menuType: string}) = (async ({schoolYear, month, menuType}) => {
const resp = await fetch(
`https://www.schools.nyc.gov/docs/default-source/school-menus/${schoolYear}/${month}/${menuType}`,
{
},
);
if (resp.status !== 200) {
console.log("status: ", resp.status)
console.log("status: ", resp.statusText)
console.log("type: ", resp.type)
console.log("headers: ", resp.headers)
console.log("keys: ", resp.headers.keys)
}
return resp.text();
});
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!
October 23, 2023