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/?q=fetch&page=510&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 8299 results for "fetch"(1055ms)

cerebras_codermain.tsx1 match

@zananowshad•Updated 5 months ago
23
24 try {
25 const response = await fetch("/", {
26 method: "POST",
27 body: JSON.stringify({ prompt, currentCode: code }),

blob_adminmain.tsx2 matches

@thobey•Updated 5 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

@omerco•Updated 5 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({

cerebras_codermain.tsx1 match

@omerco•Updated 5 months ago
23
24 try {
25 const response = await fetch("/", {
26 method: "POST",
27 body: JSON.stringify({ prompt, currentCode: code }),

uptimemain.tsx2 matches

@omerco•Updated 5 months ago
11 const start = performance.now();
12 try {
13 const res = await fetch(url);
14 end = performance.now();
15 status = res.status;
22 } catch (e) {
23 end = performance.now();
24 reason = `couldn't fetch: ${e}`;
25 ok = false;
26 console.log(`Website down (${url}): ${reason} (${end - start}ms)`);

weatherGPTmain.tsx1 match

@omerco•Updated 5 months ago
4let location = "brooklyn ny";
5let lang = "en";
6const weather = await fetch(
7 `https://wttr.in/${location}?lang=${lang}&format=j1`,
8).then(r => r.json());

lovelyYellowXerinaemain.tsx18 matches

@mikehiggins•Updated 5 months ago
187}
188
189// Updated function to fetch and parse URL content
190async function fetchUrlContent(url) {
191 try {
192 console.log('Fetching URL:', url);
193 const response = await fetch(url);
194 if (!response.ok) {
195 throw new Error(`HTTP error! status: ${response.status}`);
196 }
197 const html = await response.text();
198 console.log('Fetched HTML length:', html.length);
199 const root = parse(html);
200
228 return content;
229 } catch (error) {
230 console.error('Error fetching URL:', error);
231 throw new Error(`Failed to fetch URL content: ${error.message}`);
232 }
233}
483 try {
484 if (url.length > 0) {
485 const response = await fetch('/fetch-url', {
486 method: 'POST',
487 headers: {
493 if (!response.ok) {
494 const errorData = await response.json();
495 throw new Error(errorData.error || 'Failed to fetch URL content');
496 }
497
501
502 if (!contentToAnalyse || contentToAnalyse.trim().length === 0) {
503 throw new Error('No content to analyse. The fetched content might be empty.');
504 }
505
509 }
510
511 const analysisResponse = await fetch('/analyse', {
512 method: 'POST',
513 headers: {
713});
714
715app.post('/fetch-url', async (c) => {
716 const { url } = await c.req.json();
717
718 try {
719 console.log('Fetching URL:', url);
720 const content = await fetchUrlContent(url);
721 console.log('Fetched content length:', content.length);
722 if (content.length > 100000) {
723 return c.json({ error: "Content from URL is too long. Please try a different URL with less content." }, 400);
724 }
725 if (content.trim().length === 0) {
726 return c.json({ error: "The fetched content is empty. Please try a different URL." }, 400);
727 }
728 return c.json({ content });
729 } catch (error) {
730 console.error('Error fetching URL:', error);
731 return c.json({ error: error.message }, 400);
732 }
734
735export default async function(request: Request): Promise<Response> {
736 return app.fetch(request);
737}

ogmain.tsx17 matches

@yawnxyz•Updated 5 months ago
699}
700
701// Fetch Inter font from CDN
702async function fetchFont(url: string) {
703 const res = await fetch(url);
704 return new Uint8Array(await res.arrayBuffer());
705}
707
708
709const dmMonoLight = await fetchFont(
710 "https://cdn.jsdelivr.net/fontsource/fonts/dm-mono@latest/latin-300-normal.ttf"
711);
712const dmMonoRegular = await fetchFont(
713 "https://cdn.jsdelivr.net/fontsource/fonts/dm-mono@latest/latin-400-normal.ttf"
714);
715const dmMonoMedium = await fetchFont(
716 "https://cdn.jsdelivr.net/fontsource/fonts/dm-mono@latest/latin-500-normal.ttf"
717);
718const interLight = await fetchFont(
719 "https://cdn.jsdelivr.net/fontsource/fonts/inter@latest/latin-300-normal.ttf"
720);
721const interRegular = await fetchFont(
722 "https://cdn.jsdelivr.net/fontsource/fonts/inter@latest/latin-400-normal.ttf"
723);
724const interSemiBold = await fetchFont(
725 "https://cdn.jsdelivr.net/fontsource/fonts/inter@latest/latin-600-normal.ttf"
726);
727const interMedium = await fetchFont(
728 "https://cdn.jsdelivr.net/fontsource/fonts/inter@latest/latin-500-normal.ttf"
729);
730const ebGaramondMediumItalic = await fetchFont(
731 "https://cdn.jsdelivr.net/fontsource/fonts/eb-garamond@latest/latin-500-italic.ttf"
732);
791 }
792 } catch (error) {
793 console.error("Error fetching image from Val Town blob:", error);
794 }
795 }
1230 }
1231 } catch (error) {
1232 console.error("Error fetching image from Val Town blob:", error);
1233 }
1234 }
1915
1916 async function updateImageStats(url) {
1917 const response = await fetch(url);
1918 const blob = await response.blob();
1919 const img = new Image();
1961
1962 try {
1963 const response = await fetch(imageUrlValue + '&nocache=true');
1964 const blob = await response.blob();
1965 const url = URL.createObjectURL(blob);
2038});
2039
2040// Export app.fetch for Val Town, otherwise export app — this is only for hono apps
2041export default (typeof Deno !== "undefined" && Deno.env.get("valtown") && Deno.env.get("mode") !== "local")
2042 ? app.fetch
2043 : app;
2044

sqlite_adminmain.tsx1 match

@izuchukwu•Updated 5 months ago
9app.get("/", async (c) => c.html(await sqlite_admin_tables()));
10app.get("/:table", async (c) => c.html(await sqlite_admin_table(c.req.param("table"))));
11export default basicAuth(app.fetch);

sqliteExplorerAppmain.tsx1 match

@izuchukwu•Updated 5 months ago
150});
151
152export default basicAuth(app.fetch);

fetchPaginatedData2 file matches

@nbbaier•Updated 2 weeks ago

FetchBasic1 file match

@fredmoon•Updated 2 weeks ago