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/$2?q=fetch&page=1014&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 13565 results for "fetch"(1894ms)

lazyCookmain.tsx3 matches

@karkowg•Updated 6 months ago
20 setError("");
21 try {
22 const response = await fetch("/recipes", {
23 method: "POST",
24 headers: { "Content-Type": "application/json" },
32 }
33 } catch (err) {
34 setError("An error occurred while fetching recipes. Please try again.");
35 } finally {
36 setLoading(false);
339
340async function generateImage(recipeName: string): Promise<string> {
341 const response = await fetch(`https://maxm-imggenurl.web.val.run/${encodeURIComponent(recipeName)}`);
342 if (!response.ok) {
343 throw new Error(`Failed to generate image for ${recipeName}`);

RepresentingAJokemain.tsx5 matches

@lentinimojchers•Updated 6 months ago
1import { email } from "https://esm.town/v/std/email?v=9";
2
3// Fetches a random joke.
4// Fetches a random joke.
5async function fetchRandomJoke() {
6 const response = await fetch(
7 "https://official-joke-api.appspot.com/random_joke",
8 );
10}
11
12const randomJoke = await fetchRandomJoke();
13const setup = randomJoke.setup;
14const punchline = randomJoke.punchline;

visionaryPeachAspmain.tsx3 matches

@stevekrouse•Updated 6 months ago
171 // Existing API proxy logic
172 const { API_URL } = await import("https://esm.town/v/std/API_URL?v=5");
173 const { fetchJSON } = await import("https://esm.town/v/stevekrouse/fetchJSON");
174 const { sqlite } = await import("https://esm.town/v/stevekrouse/sqlite");
175 const Authorization = req.headers.get("Authorization") as string;
176 const meRes = await fetch(`${API_URL}/v1/me`, { headers: { Authorization } });
177 if (!meRes.ok) {
178 return new Response("Unauthorized", { status: 401 });
234 const socialDataURL = new URL("https://api.socialdata.tools/twitter/search");
235 socialDataURL.searchParams.set("query", query);
236 const socialDataResults = await fetchJSON(socialDataURL.toString(), {
237 bearer: Deno.env.get("SOCIAL_DATA_API_KEY"),
238 });

spectacularAzureAngelfishmain.tsx6 matches

@stevekrouse•Updated 6 months ago
6
7import { API_URL } from "https://esm.town/v/std/API_URL?v=5";
8import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON";
9import { sqlite } from "https://esm.town/v/stevekrouse/sqlite";
10
19
20 useEffect(() => {
21 async function fetchUsageData() {
22 const response = await fetch('/usage-data');
23 const data = await response.json();
24 setUsageData(data);
25 }
26 fetchUsageData();
27 }, []);
28
132 // Existing social data proxy logic remains unchanged
133 const Authorization = req.headers.get("Authorization") as string;
134 const meRes = await fetch(`${API_URL}/v1/me`, { headers: { Authorization } });
135 if (!meRes.ok) {
136 return new Response("Unauthorized", { status: 401 });
192 const socialDataURL = new URL("https://api.socialdata.tools/twitter/search");
193 socialDataURL.searchParams.set("query", query);
194 const socialDataResults = await fetchJSON(socialDataURL.toString(), {
195 bearer: Deno.env.get("SOCIAL_DATA_API_KEY"),
196 });

renderHTMLWithHonomain.tsx1 match

@tristanmagne•Updated 6 months ago
61
62export default async function server(req: Request): Promise<Response> {
63 return app.fetch(req);
64}

sqliteExplorerAppmain.tsx4 matches

@mparker•Updated 6 months ago
1/** @jsxImportSource https://esm.sh/hono@latest/jsx **/
2
3import { modifyFetchHandler } from "https://esm.town/v/andreterron/codeOnValTown?v=50";
4import { iframeHandler } from "https://esm.town/v/nbbaier/iframeHandler";
5import { resetStyle } from "https://esm.town/v/nbbaier/resetStyle";
16import { verifyToken } from "https://esm.town/v/pomdtr/verifyToken";
17import { ResultSet, sqlite } from "https://esm.town/v/std/sqlite";
18import { reloadOnSaveFetchMiddleware } from "https://esm.town/v/stevekrouse/reloadOnSave";
19import { Hono } from "npm:hono";
20import type { FC } from "npm:hono/jsx";
175});
176
177export const handler = app.fetch;
178export default iframeHandler(modifyFetchHandler(passwordAuth(handler, { verifyPassword: verifyToken })));

sharpCoralCoyotemain.tsx1 match

@tompatiger•Updated 6 months ago
5
6def get_quotes():
7 """Fetches quotes from Wikiquote."""
8
9 url = "https://en.wikiquote.org/wiki/Main_Page"

petunia_chatmain.tsx6 matches

@robertmccallnz•Updated 6 months ago
137
138 try {
139 const response = await fetch('/chat', {
140 method: 'POST',
141 headers: {
260 }
261
262 async function fetchMarketInsights() {
263 try {
264 const response = await fetch('/market-data', {
265 method: 'GET',
266 headers: { 'Accept': 'application/json' }
268
269 if (!response.ok) {
270 throw new Error('Failed to fetch market data');
271 }
272
298 }
299
300 refreshButton.addEventListener('click', fetchMarketInsights);
301 </script>
302 <footer>
368});
369
370export default app.fetch;

forEmulated1main.tsx1 match

@manyone•Updated 6 months ago
46 setIsRefining(isInitial ? false : true);
47 try {
48 const response = await fetch('/generate-landing-page', {
49 method: 'POST',
50 headers: {

LotecaV2main.tsx1 match

@maxm•Updated 6 months ago
62
63 try {
64 const resposta = await fetch(url);
65
66 if (!resposta.ok) {

GithubPRFetcher

@andybak•Updated 2 days ago

proxiedfetch1 file match

@jayden•Updated 3 days ago