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=640&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 9191 results for "fetch"(1774ms)

joinMatrixRoommain.tsx2 matches

@dm3agv•Updated 8 months ago
1import { fetch } from "https://esm.town/v/std/fetch";
2
3export const joinMatrixRoom = async (
17 },
18 };
19 return await fetch(url, config);
20};

blob_adminmain.tsx2 matches

@ianvph•Updated 8 months ago
1/** @jsxImportSource https://esm.sh/hono@4.0.8/jsx **/
2
3import { modifyFetchHandler } from "https://esm.town/v/andreterron/codeOnValTown?v=50";
4import view_route from "https://esm.town/v/pomdtr/blob_admin_blob";
5import create_route from "https://esm.town/v/pomdtr/blob_admin_create";
137});
138
139export default modifyFetchHandler(passwordAuth(app.fetch));

blob_adminmain.tsx2 matches

@aymeeko•Updated 8 months ago
1/** @jsxImportSource https://esm.sh/hono@4.0.8/jsx **/
2
3import { modifyFetchHandler } from "https://esm.town/v/andreterron/codeOnValTown?v=50";
4import view_route from "https://esm.town/v/pomdtr/blob_admin_blob";
5import create_route from "https://esm.town/v/pomdtr/blob_admin_create";
137});
138
139export default modifyFetchHandler(passwordAuth(app.fetch));

calculateTransitTimeValmain.tsx15 matches

@rochambeau314•Updated 8 months ago
14
15 useEffect(() => {
16 fetchSavedResults();
17 }, []);
18
19 const fetchSavedResults = async () => {
20 try {
21 const response = await fetch("/getSavedResults");
22 if (response.ok) {
23 const data = await response.json();
25 }
26 } catch (err) {
27 console.error("Error fetching saved results:", err);
28 }
29 };
33 console.log("Calculating travel times for origin:", origin);
34 try {
35 const response = await fetch(`/calculate?origin=${encodeURIComponent(origin)}`);
36 const data = await response.json();
37 console.log("Received response:", data);
51 const deleteResult = async (index) => {
52 try {
53 const response = await fetch(`/deleteResult?index=${index}`, { method: "DELETE" });
54 if (response.ok) {
55 setResults(prevResults => prevResults.filter((_, i) => i !== index));
169 });
170 } catch (error) {
171 console.error("Error fetching saved results:", error);
172 return new Response(JSON.stringify({ error: "Failed to fetch saved results" }), {
173 status: 500,
174 headers: { "Content-Type": "application/json" },
231 const { blob } = await import("https://esm.town/v/std/blob");
232
233 console.log("Fetching grocery and gym data");
234 const groceries = await blob.getJSON("SF_Grocery");
235 const gyms = await blob.getJSON("SF_Gyms");
236 console.log(`Fetched ${groceries.length} groceries and ${gyms.length} gyms`);
237
238 console.log("Finding nearest grocery");
328 }&destinations=${encodeURIComponent(destinations)}&mode=driving&key=${apiKey}`;
329
330 console.log(`Fetching from Distance Matrix API for batch ${i / batchSize + 1}`);
331 const response = await fetch(distanceMatrixUrl);
332 const data = await response.json();
333 console.log("Distance Matrix API response status:", data.status);
376 }
377
378 const directionsResponse = await fetch(directionsUrl);
379 const directionsData = await directionsResponse.json();
380
393 }&destination=${encodeURIComponent(destination)}&mode=transit&key=${apiKey}`;
394
395 const directionsResponse = await fetch(directionsUrl);
396 const directionsData = await directionsResponse.json();
397
409 encodeURIComponent(address)
410 }&key=${apiKey}`;
411 const response = await fetch(geocodeUrl);
412 const data = await response.json();
413

blob_adminmain.tsx2 matches

@sammeltassen•Updated 8 months ago
1/** @jsxImportSource https://esm.sh/hono@4.0.8/jsx **/
2
3import { modifyFetchHandler } from "https://esm.town/v/andreterron/codeOnValTown?v=50";
4import view_route from "https://esm.town/v/pomdtr/blob_admin_blob";
5import create_route from "https://esm.town/v/pomdtr/blob_admin_create";
137});
138
139export default modifyFetchHandler(passwordAuth(app.fetch));

dailySlackRoundupmain.tsx2 matches

@brianbscho•Updated 8 months ago
1import { fetch } from "https://esm.town/v/std/fetch";
2import { getDayName } from "https://esm.town/v/stevekrouse/getDayName?v=2";
3import process from "node:process";
4
5export const dailySlackRoundup = (async () => {
6 const res = await fetch(process.env.BRAINBOT_WEBHOOK_URL, {
7 method: "POST",
8 body: JSON.stringify({

free_open_routermain.tsx6 matches

@taras•Updated 8 months ago
160 ];
161
162 // Create fetch promises for each API endpoint
163 const fetchPromises = apiEndpoints.map(({ url, token }) =>
164 fetch(url, {
165 headers: {
166 "Authorization": `Bearer ${token}`,
169 );
170
171 // Wait for all fetch promises to resolve
172 const responses = await Promise.all(fetchPromises);
173
174 // Extract response bodies
328 });
329 } /*completion*/ else {
330 let response = await fetch(url.toString(), init);
331 // 429: preview model unavailable
332 // 408: model timeout

openapi_playgroundmain.tsx2 matches

@stainless_em•Updated 8 months ago
224 if (load) {
225 try {
226 code = await (await fetch(new URL(load, "https://esm.town/v/")))
227 .text();
228 code = YAML.stringify(YAML.parse(code));
265 }
266});
267export default app.fetch;

runmain.tsx1 match

@websandbox•Updated 8 months ago
28 });
29 const start = performance.now();
30 const res = await fetch(API_URL + "/v1/eval", {
31 method: "POST",
32 body: JSON.stringify({

createAPImain.tsx1 match

@websandbox•Updated 8 months ago
48 privacy: "unlisted",
49 });
50 await fetch("https://www.val.town/api/trpc/updateVal", {
51 headers: {
52 "content-type": "application/json",

proxyFetch2 file matches

@vidar•Updated 1 day ago

TAC_FetchBasic2 file matches

@A7_OMC•Updated 1 day ago