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=8&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 14500 results for "fetch"(2623ms)

shitty-leaderboardindex.ts10 matches

@jonbo•Updated 2 days ago
41 }, []);
42
43 // Fetch leaderboard data
44 const fetchLeaderboard = async () => {
45 if (!instanceId) return;
46
48 setIsLoading(true);
49
50 // Fetch chores and history in parallel with cache-busting
51 const timestamp = Date.now();
52 const [choresResponse, historyResponse] = await Promise.all([
53 fetch(`/api/${instanceId}/chores?_t=${timestamp}`),
54 fetch(`/api/${instanceId}/history?_t=${timestamp}`),
55 ]);
56
57 if (!choresResponse.ok || !historyResponse.ok) {
58 throw new Error("Failed to fetch data");
59 }
60
126 setIsLoading(false);
127 } catch (err) {
128 console.error("Error fetching leaderboard:", err);
129 setError("Failed to load leaderboard data");
130 setIsLoading(false);
132 };
133
134 // Initial fetch and polling
135 useEffect(() => {
136 if (!instanceId) return;
137
138 fetchLeaderboard();
139
140 // Poll every 30 seconds for real-time updates
141 const interval = setInterval(fetchLeaderboard, 30000);
142
143 return () => clearInterval(interval);

send-transcriptsmain.tsx1 match

@sunnyatlightswitch•Updated 2 days ago
176});
177
178export default app.fetch;
Plantfo

Plantfoindex.ts5 matches

@Llad•Updated 2 days ago
176 }
177
178 console.log(`Fetching fresh data from OpenAI for: "${plantName}"`);
179 // If not cached, fetch from OpenAI
180 const prompt =
181 `Please provide detailed information about the plant "${plantName}" in the following JSON format. Be specific and accurate:
261 }
262 } catch (error) {
263 console.error("Error fetching plant information:", error);
264 return c.json({
265 error: "Failed to fetch plant information",
266 details: error instanceof Error ? error.message : "Unknown error",
267 }, 500);
390});
391
392export default app.fetch; // This is the entry point for HTTP vals

orbiterHealthmonitor3 matches

@stevedylandev•Updated 2 days ago
10async function notifySlack(message: string) {
11 try {
12 await fetch(WEBHOOK_URL, {
13 method: "POST",
14 headers: {
29 const start = performance.now();
30 try {
31 const res = await fetch(url);
32 end = performance.now();
33 status = res.status;
40 } catch (e) {
41 end = performance.now();
42 reason = `couldn't fetch: ${e}`;
43 ok = false;
44 console.log(`Website down (${url}): ${reason} (${end - start}ms)`);

fiberplaneHonoTracingStartermain.tsx1 match

@hrev•Updated 2 days ago
57});
58
59export default instrument(app, { libraryDebugMode: true }).fetch;
60

sapo-mag-filmes-em-cartazmain.tsx2 matches

@gmcabrita•Updated 2 days ago
5export default async (req?: Request) => {
6 const url = "https://mag.sapo.pt/filmes/no-cinema";
7 const r = await fetch(url);
8 if (!r.ok)
9 return new Response("Failed to fetch data", { status: 502 });
10
11 const text = await r.text();

HelloWorld2server.tsx1 match

@wolf•Updated 2 days ago
6 .get("/foo", (c) => c.text("hello", 200));
7
8export default app.fetch;

docjocmain.tsx6 matches

@legal•Updated 2 days ago
328 currentAnalysisSession.docSource = \`File: \${currentAnalysisSession.docName}\`;
329 currentAnalysisSession.step = 2;
330 fetchAndPopulateSuggestions();
331 }
332
420
421 if (suggestionsError) {
422 document.getElementById('retry-suggestions-btn').addEventListener('click', fetchAndPopulateSuggestions);
423 }
424
479 const formData = new FormData();
480 formData.append('documentFile', file, file.name);
481 const res = await fetch(window.location.pathname + '?action=suggestTasks&format=json', { method: 'POST', body: formData });
482 const data = await res.json().catch(() => { throw new Error(\`Server error: \${res.status}. Invalid JSON.\`); });
483 if (!res.ok || data.error) throw new Error(data.error || \`Server error: \${res.status}\`);
500}
501
502async function fetchAndPopulateSuggestions() {
503 currentAnalysisSession.isProcessing = true;
504 currentAnalysisSession.suggestionsError = null;
508 const formData = new FormData();
509 formData.append('documentText', currentAnalysisSession.docText.substring(0, 10000));
510 const res = await fetch(window.location.pathname + '?action=suggestTasks&format=json', { method: 'POST', body: formData });
511 const data = await res.json().catch(() => { throw new Error(\`Server returned non-JSON: \${res.status}\`); });
512 if (!res.ok || data.error) throw new Error(data.error || \`Server Error: \${res.status}\`);
654 formData.append('inputSourceDescription', currentAnalysisSession.docSource);
655
656 const res = await fetch(window.location.pathname + '?format=json', { method: 'POST', body: formData });
657 const data = await res.json().catch(() => { throw new Error(\`Server error: \${res.status}. Invalid JSON.\`); });
658 if (!res.ok || data.error) throw new Error(JSON.stringify(data.error || data.details) || \`Server error: \${res.status}\`);

Synthesizemain.tsx2 matches

@talkbot•Updated 2 days ago
72});
73
74// Export the Hono app's fetch handler, which is the standard for Val Town HTTP endpoints
75export default app.fetch;

Townietext-editor.ts1 match

@valdottown•Updated 2 days ago
166 let type_: "file" | "http" | "script";
167 if (path.includes("backend/index.ts")) type_ = "http";
168 if (file_text?.includes("export default app.fetch")) type_ = "http";
169 if ([".ts", ".tsx", ".js", ".jsx"].some(ext => path.endsWith(ext))) {
170 type_ = "script";

testWeatherFetcher1 file match

@sjaskeprut•Updated 2 days ago

weatherFetcher1 file match

@sjaskeprut•Updated 2 days ago