Val Town Code SearchReturn to Val Town

API Access

You can access search results via JSON API by adding format=json to your query:

https://codesearch.val.run/$%7Bsuccess?q=fetch&page=742&format=json

For typeahead suggestions, use the /typeahead endpoint:

https://codesearch.val.run/typeahead?q=fetch

Returns an array of strings in format "username" or "username/projectName"

Found 8415 results for "fetch"(1669ms)

fetchHeadersmain.tsx2 matches

@stevekrouse•Updated 1 year ago
1import { fetch } from "https://esm.town/v/std/fetch";
2
3export let fetchHeaders = (await fetch("https://swapi.dev/api/people/1/")).headers;

r2main.tsx2 matches

@stevekrouse•Updated 1 year ago
1import { runValAPIAuth } from "https://esm.town/v/stevekrouse/runValAPIAuth";
2import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON";
3import { whoami } from "https://esm.town/v/stevekrouse/whoami";
4
8 let handle = whoami().at(-1).slice(1).split(".")[0]
9 .replace("@", "");
10 return fetchJSON(
11 `https://pub-6feb98c078874338b9a3bce6ab56e815.r2.dev/${handle}/${key}`,
12 { agent: null },

untitled_B7XzWEHMmain.tsx2 matches

@stevekrouse•Updated 1 year ago
1import { fetch } from "https://esm.town/v/std/fetch";
2
3export const untitled_B7XzWEHM = (
4 await fetch(
5 "https://api.val.town/v1/run/paulsun.parkingSpots" +
6 `?args=${JSON.stringify([lat, lng, radius])}`

runAllTests2main.tsx2 matches

@stevekrouse•Updated 1 year ago
1import { TEST_API } from "https://esm.town/v/stevekrouse/TEST_API";
2import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON";
3
4export async function runAllTests2({ names }: { names: string[] }) {
5 return names.map((name) =>
6 fetchJSON(`${TEST_API}/eval/@stevekrouse.${name}()`)
7 .then(({ data, error }) => (data ?? error?.message) + ` (${name})`)
8 );

catFactmain.tsx3 matches

@yuval_dikerman•Updated 1 year ago
1import { fetch } from "https://esm.town/v/std/fetch";
2import process from "node:process";
3
4export let catFact = async (request: Request): Promise<Response> => {
5 let cat = await fetch("https://catfact.ninja/fact");
6 let { fact } = await cat.json();
7 const prompt =
8 "Rewrite this fact about cats as if it was written for 3 year old:\n\n" +
9 fact;
10 const story = await fetch("https://api.openai.com/v1/chat/completions", {
11 method: "POST",
12 body: JSON.stringify({

getAllNotionDbRowsmain.tsx1 match

@supersayan•Updated 1 year ago
32 console.log(
33 length
34 ? `Successfully fetched ${length} row${length === 1 ? "" : "s"}`
35 : "No rows found",
36 );

aqimain.tsx2 matches

@colinz•Updated 1 year ago
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=41";
2
3export let aqi = async () => {
4 let pm25 = (
5 await fetchJSON(
6 "https://api.openaq.org/v2/latest?" +
7 new URLSearchParams({

publishYoutubeToLemmymain.tsx1 match

@pdebie•Updated 1 year ago
14 const { LemmyHttp } = await import("npm:lemmy-js-client@0.18.1");
15 let client = new LemmyHttp(`https://${instance}`, {
16 fetchFunction: fetch,
17 });
18 const items =

youtubeFeedmain.tsx2 matches

@pdebie•Updated 1 year ago
1import { fetchRss } from "https://esm.town/v/pdebie/fetchRss";
2
3export function youtubeFeed(channelId: string, lastCheckDate?: string | number) {
4 return fetchRss(
5 "https://www.youtube.com/feeds/videos.xml?channel_id=" + channelId,
6 lastCheckDate,

proxyFetch2main.tsx5 matches

@alp•Updated 1 year ago
1import { fetch } from "https://esm.town/v/std/fetch";
2
3export const proxyFetch2 = 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};

fetchPaginatedData2 file matches

@nbbaier•Updated 2 weeks ago

FetchBasic1 file match

@fredmoon•Updated 2 weeks ago