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/$%7BsvgDataUrl%7D?q=fetch&page=2&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 14440 results for "fetch"(3190ms)

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

@gmcabrita•Updated 15 hours 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 16 hours ago
6 .get("/foo", (c) => c.text("hello", 200));
7
8export default app.fetch;

docjocmain.tsx6 matches

@legal•Updated 16 hours 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}\`);

brokenLinkCrawlerurlGetter.tsx2 matches

@willthereader•Updated 16 hours ago
30 let html = "";
31 try {
32 const response = await fetch(linkObject.url);
33 const contentType = response.headers.get("content-type") || "";
34 if (!contentType.includes("text/html")) continue;
35 html = await response.text();
36 } catch (err) {
37 console.warn("Fetch failed for", linkObject.url, err);
38 continue;
39 }

Synthesizemain.tsx2 matches

@talkbot•Updated 17 hours 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 18 hours 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";

TownieMessages.tsx9 matches

@valdottown•Updated 19 hours ago
256 </>
257 );
258 case "fetch":
259 return (
260 <Details
269 summary={(
270 <>
271 <div>fetch:</div>
272 <div>{args?.valPath}</div>
273 <div>{args?.urlPath || "/"}</div>
275 )}>
276 {result?.type === "success" ? (
277 <div className="fetch-result">
278 <div className="fetch-header">
279 <span className={`status-badge ${result.data.status >= 200 && result.data.status < 300 ? 'success' :
280 result.data.status >= 300 && result.data.status < 400 ? 'redirect' :
284 <span className="response-time">{result.data.responseTime}ms</span>
285 </div>
286 <div className="fetch-section">
287 <h4>Headers</h4>
288 <pre className="fetch-headers">{JSON.stringify(result.data.headers, null, 2)}</pre>
289 </div>
290 <div className="fetch-section">
291 <h4>Response Body</h4>
292 <pre className="fetch-body">
293 {typeof result.data.body === 'object'
294 ? JSON.stringify(result.data.body, null, 2)
298 </div>
299 ) : (
300 <div className="fetch-error">
301 <h4>Error</h4>
302 <pre>{result?.message || "Unknown error"}</pre>

untitled-2285main.tsx1 match

@stevekrouse•Updated 19 hours ago
7});
8
9export default app.fetch;

statusmonitor2 matches

@helge•Updated 20 hours ago
18 const start = performance.now();
19 try {
20 res = await fetch(url);
21 end = performance.now();
22 status = res.status;
28 } catch (e) {
29 end = performance.now();
30 reason = `couldn't fetch: ${e}`;
31 ok = false;
32 }

kebede-and-ben-testApp.tsx2 matches

@bmitchinson•Updated 20 hours ago
16
17 try {
18 const response = await fetch('/api/game', {
19 method: 'POST',
20 headers: {
47 const moveData: MoveRequest = { position };
48
49 const response = await fetch(`/api/game/${game.id}/move`, {
50 method: 'PUT',
51 headers: {

testWeatherFetcher1 file match

@sjaskeprut•Updated 1 day ago

weatherFetcher1 file match

@sjaskeprut•Updated 1 day ago