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=653&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 9070 results for "fetch"(2038ms)

githubGistsmain.tsx2 matches

@scott•Updated 8 months ago
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=41";
2
3// GitHub gists
4export let githubGists = fetchJSON(
5 "https://api.github.com/users/stevekrouse/gists",
6);

razzamain.tsx2 matches

@gio•Updated 8 months ago
119 function updateExistingCodes() {
120 const category = document.getElementById('filterCategory').value;
121 fetch('/existing-qr-codes?category=' + encodeURIComponent(category))
122 .then(response => response.json())
123 .then(codes => {
205 }
206
207 fetch('/generate', {
208 method: 'POST',
209 headers: {

nasaImageDetailsmain.tsx2 matches

@kcorey•Updated 8 months ago
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON";
2
3export const nasaImageDetails = async () => {
4 const nasaAPOD = await fetchJSON("https://api.nasa.gov/planetary/apod?api_key=DEMO_KEY");
5 let nasaImageHtml = nasaAPOD.hdurl
6 ? `<img width="100%" src="${nasaAPOD.hdurl}"/>`

promptGenmain.tsx1 match

@all•Updated 8 months ago
29 setLoading(true);
30 try {
31 const response = await fetch("/generate", {
32 method: "POST",
33 headers: { "Content-Type": "application/json" },

multirouteHonomain.tsx1 match

@cofsana•Updated 8 months ago
108});
109
110export default app.fetch;
111
112const css = `

postmanClonemain.tsx3 matches

@maxm•Updated 8 months ago
1/**
2 * This val creates a Postman-like interface for testing HTTP requests directly in the browser.
3 * It uses React for the UI and the Fetch API to make requests.
4 * The server function serves the HTML and handles the API requests.
5 */
24 body: method !== 'GET' && body ? body : undefined
25 };
26 const res = await fetch('/proxy', {
27 method: 'POST',
28 headers: { 'Content-Type': 'application/json' },
108 const { url: targetUrl, options } = await request.json();
109 try {
110 const response = await fetch(targetUrl, options);
111 const data = await response.json();
112 return new Response(JSON.stringify({

niceTodoListmain.tsx1 match

@maxm•Updated 8 months ago
43 }
44
45 // Fetch todos from the database
46 const todos = await sqlite.execute(`SELECT * FROM ${KEY}_todos_${SCHEMA_VERSION} ORDER BY id DESC`);
47

multiplayerCirclesmain.tsx2 matches

@lisardo•Updated 8 months ago
86 const y = d3.select(this).attr("cy");
87
88 fetch(`/update?x=${x}&y=${y}&i=${d3.select(this).attr("idx")}`, { method: "post" });
89 d3.select(this).attr("stroke", null);
90 }
190 return new Response(body, { headers: { "Content-Type": "text/event-stream" } });
191});
192export default app.fetch;

blob_adminmain.tsx2 matches

@supercreative•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));

getContentFromUrlmain.tsx16 matches

@yawnxyz•Updated 8 months ago
34 };
35
36 console.log('[getJinaContent] Fetching:', fullUrl.toString(), headers);
37
38 try {
39 const response = await fetch(fullUrl.toString(), {
40 method: 'GET',
41 headers: headers,
61 }
62 } catch (error) {
63 console.error('Error fetching from Jina:', error);
64 throw error;
65 }
94 };
95
96 console.log('[getFirecrawlContent] Fetching:', url, body);
97
98 try {
99 const response = await fetch("https://api.firecrawl.dev/v0/scrape", {
100 method: 'POST',
101 headers: {
115 return resultText;
116 } catch (error) {
117 console.error('Error fetching from Firecrawl:', error);
118 throw error;
119 }
129
130 let [response, metadata] = await Promise.all([
131 fetch(url),
132 getUrlMetadata(ogUrl)
133 ]);
182 return output
183 } catch (error) {
184 console.error('Error fetching the URL:', error);
185 return 'Error fetching the content: ', error.message || error || 'Unknown error.';
186 }
187};
263 };
264
265 const fetchMetadata = optsArray.includes('metadata') || optsArray.includes('doi') || optsArray.includes('citation');
266 let metadata;
267
268 if (fetchMetadata) {
269 metadata = await getUrlMetadata(ogUrl);
270 }
275 : await getJinaContent(serviceUrl, requestOptions);
276
277 if (fetchMetadata && !metadata) {
278 const html = crawlMode === 'fire'
279 ? await getFirecrawlContent(serviceUrl, { returnFormat: 'html' })
336 return output;
337 } catch (error) {
338 console.error('Error fetching the URL:', error);
339 throw new Error('Error fetching the content: ' + error.message || error || 'Unknown error.');
340 // return 'Error fetching the content: ' + error.message || error || 'Unknown error.';
341 }
342};
475
476
477export default app.fetch;
478

proxyFetch2 file matches

@vidar•Updated 4 hours ago

TAC_FetchBasic2 file matches

@A7_OMC•Updated 18 hours ago