1import { fetch } from "https://esm.town/v/std/fetch";
2
3export async function wikitxt(article: string) {
4 try {
5 const wiki = await fetch(
6 `https://en.wikipedia.org/w/api.php?action=query&format=json&titles=${article}&prop=extracts&explaintext`,
7 ).then((res) => res.json());
14 }
15 catch (error) {
16 throw new Error(`Wiki fetch failed: ${error}`);
17 }
18}
1import { fetchText } from "https://esm.town/v/stevekrouse/fetchText";
2
3export const noProxyEx = fetchText(
4 "https://www.schools.nyc.gov/docs/default-source/school-menus/2022-2023/june/pre-k---8-lunch-menu",
5 {
1import { dateMeURL } from "https://esm.town/v/stevekrouse/dateMeURL";
2import { fetchTable } from "https://esm.town/v/stevekrouse/fetchTable";
3
4export const dateMeProfiles = fetchTable(
5 dateMeURL,
6);
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON";
2
3export async function runAllTests({
19 results.push(
20 (
21 await fetchJSON(
22 `${api}/eval/@stevekrouse.${name}("${encodeURIComponent(api)}")`
23 )
1import { fetchDateMeProfiles } from "https://esm.town/v/stevekrouse/fetchDateMeProfiles";
2import { notifyNew } from "https://esm.town/v/stevekrouse/notifyNew";
3
6// Requires an upstash account: https://docs.val.town/persistence-databases/upstash
7export let dateMeNotify = notifyNew({
8 getData: fetchDateMeProfiles,
9 name: "Date Me Profile",
10});
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON";
2
3// GitHub events
4export let githubEvents = fetchJSON(
5 "https://api.github.com/users/stevekrouse/events"
6);
1import { fetch } from "https://esm.town/v/std/fetch";
2
3export async function pingReplit() {
4 fetch("https://bed.paperee.repl.co/");
5 fetch("https://school-work.paperee.repl.co/");
6}
1import { fetch } from "https://esm.town/v/std/fetch";
2
3export const proxyFetch7 = async (req, res) => {
4 const { url, options } = req.body;
5 try {
6 const response = await fetch(url, options);
7 return res.status(response.status).send(await response.text());
8 } catch (e) {
9 const errorMessage = e instanceof Error ? e.message : "Unknown error";
10 console.error("Failed to initiate fetch", e);
11 return res.status(500).send(`Failed to initiate fetch: ${errorMessage}`);
12 }
13};
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=41";
2
3// Explore the Star Wars universe, from StarWarsAPI
4export let starWars = fetchJSON(
5 "https://swapi.dev/api/people/1/"
6);
17 const args = Array.from(formData.values()).map(Number);
18
19 fetch('https://api.val.town/v1/run/rodrigotello.multiplicationFunctionTest', {
20 method: 'POST',
21 headers: { 'Content-Type': 'application/json' },