1import { fetch } from "https://esm.town/v/std/fetch";
2
3export const openstreetmapAPIexample = (async () => {
4 return (await fetch("https://api.openstreetmap.org/api/0.6/node/1", {
5 headers: { accept: "application/json" },
6 })).json();
1import { fetchTweet } from "https://esm.town/v/dpetrouk/fetchTweet?v=35";
2
3export let notionValLinkTweet =
4 (await fetchTweet(
5 "https://twitter.com/stevekrouse/status/1686075940076449792",
6 )).text;
1import { fetch } from "https://esm.town/v/std/fetch";
2
3export let valTownApiExampleSearch = (async () => {
4 const query = new URLSearchParams({ query: "lodash", limit: "4" });
5 const response = await fetch(`https://api.val.town/v1/search/vals?${query}`);
6 const json = await response.json();
7 return json;
1import { fetch } from "https://esm.town/v/std/fetch";
2
3export let blocks_inner = async (req, res) => {
4 const [_, user, id, ...file] = req.path.split("/");
5 const gist = await fetch(`https://api.github.com/gists/${id}`).then((r) =>
6 r.json()
7 );
11 res.set("Content-Type", "application/javascript");
12 return res.send(
13 await fetch(gist.files[file.filter(Boolean).join("/")].raw_url).then(
14 (r) => r.text()
15 ),
76 });
77 });
78 return app.fetch(req);
79};
41 });
42 });
43 return app.fetch(req);
44});
1import { fetch } from "https://esm.town/v/std/fetch";
2
3let { californiaBusinessNotificationsLast } = await import("https://esm.town/v/tmcw/californiaBusinessNotificationsLast");
5export const californiaBusinessNotifications = (async () => {
6 const { parse } = await import("https://deno.land/x/xml/mod.ts");
7 const res: any = await fetch(
8 "https://bizfileonline.sos.ca.gov/api/FilingDetail/business/4603/false",
9 {
1import { fetch } from "https://esm.town/v/std/fetch";
2
3// E.g. from a user's perspective (not the real execution time!)
8 for (let i = 0; i < count; i++) {
9 let start = Date.now();
10 await fetch("https://api.val.town/eval/(()=%3E1+1)()");
11 evalTimes.push(Date.now() - start);
12 }
23 for (let i = 0; i < count; i++) {
24 let start = Date.now();
25 await fetch("https://api.val.town/eval/@healeycodes.addOnes()");
26 userFuncTimes.push(Date.now() - start);
27 }
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=41";
2
3// Github following!
4export let githubFollowing = (() => {
5 throw new Error(`${fetchJSON.impl.toString()}`);
6 return fetchJSON(
7 "https://api.github.com/users/stevekrouse/following"
8 );
1import { fetch } from "https://esm.town/v/std/fetch";
2
3export let jsYAMLExample = (async () => {
4 // Import the YAML parser
5 const jsYaml = await import("npm:js-yaml");
6 // Fetch a YAML file
7 const yaml = await fetch(
8 "https://raw.githubusercontent.com/docker/engine/8955d8da8951695a98eb7e15bead19d402c6eb27/api/swagger.yaml",
9 ).then((r) => r.text());
10 // parse the fetched file
11 const obj = jsYaml.load(yaml);
12 // Return part of the file