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=764&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 8301 results for "fetch"(1690ms)

measureValTownE2emain.tsx3 matches

@tmcw•Updated 1 year ago
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 }

githubFollowingmain.tsx3 matches

@tmcw•Updated 1 year ago
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 );

jsYAMLExamplemain.tsx4 matches

@tmcw•Updated 1 year ago
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

trackIphoneTradeinmain.tsx2 matches

@tmcw•Updated 1 year ago
1import { fetch } from "https://esm.town/v/std/fetch";
2
3export const trackIphoneTradein = async () => {
4 const cheerio = await import("npm:cheerio@1.0.0-rc.12");
5 const page = await fetch(
6 "https://www.apple.com/shop/browse/overlay/tradein_landing/iphone_values",
7 ).then((r) => r.text());
1import { fetch } from "https://esm.town/v/std/fetch";
2
3export const politelyinvinciblepointerHandleFormEx = (async () => {
4 let body = { args: [{ email: "example@example.com" }] };
5 const response =
6 (await fetch(
7 "https://api.val.town/v1/run/politelyinvinciblepointer.handleForm",
8 {

postWebhookTest1main.tsx2 matches

@stevekrouse•Updated 1 year ago
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON";
2
3export let postWebhookTest1 = fetchJSON(
4 "https://stevekrouse-postWebhook1.express.val.run",
5 {

textToImageDallemain.tsx2 matches

@stevekrouse•Updated 1 year ago
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON";
2
3export const textToImageDalle = async (
16 message: string;
17 };
18 } = await fetchJSON(
19 "https://api.openai.com/v1/images/generations",
20 {

arenaHelpersmain.tsx3 matches

@korede•Updated 1 year ago
1import { fetch } from "https://esm.town/v/std/fetch";
2
3export const arenaHelpers = (async () => {
23 const url = `https://api.are.na/v2/users/${userId}/channels` +
24 (Object.keys(params).length ? `?${urlParams.toString()}` : "");
25 const response = await fetch(url, {
26 headers,
27 });
28 console.log("DEBUG", "end fetch user w channels");
29 return await response.json();
30 }

newChatGPT35main.tsx2 matches

@bingo16•Updated 1 year ago
1import { fetch } from "https://esm.town/v/std/fetch";
2import process from "node:process";
3
14 };
15 const getCompletion = async () => {
16 const response = await fetch("https://api.openai.com/v1/chat/completions", {
17 method: "POST",
18 headers: {

nameTopHNThreadCronmain.tsx2 matches

@elsif_maj•Updated 1 year ago
1import { fetch } from "https://esm.town/v/std/fetch";
2import { set } from "https://esm.town/v/std/set?v=11";
3import { topHNThreadByHour } from "https://esm.town/v/elsif_maj/topHNThreadByHour";
6 // Cheerio parses markup and provides an API to interact with the resulting data structure
7 const cheerio = await import("npm:cheerio"); // You can import NPM packages
8 const reply = await fetch("https://news.ycombinator.com/");
9 const replyText = await reply.text();
10 const $ = await cheerio.load(replyText);

fetchPaginatedData2 file matches

@nbbaier•Updated 2 weeks ago

FetchBasic1 file match

@fredmoon•Updated 2 weeks ago