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=205&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 15666 results for "fetch"(7684ms)

mcp-servermain.ts25 matches

@AIWB•Updated 1 month ago
2import { Hono, Context } from 'npm:hono';
3import { SSETransport } from 'npm:hono-mcp-server-sse-transport';
4import { toFetchResponse, toReqRes } from "npm:fetch-to-node";
5import { z } from "npm:zod";
6import lunr from "https://cdn.skypack.dev/lunr";
183 { limit: z.number().optional() },
184 async ({ limit }) => {
185 console.log(`${new Date().toISOString()} Fetching proverbs data`);
186 const proverbs = await fetch("https://www.joshbeckman.org/assets/js/proverbs.json").then((res) => res.json());
187 const results = proverbs
188 .sort(() => Math.random() - 0.5)
189 .slice(0, limit || 100);
190 console.log(`${new Date().toISOString()} Proverbs data fetched`);
191 const data = results.join("\n");
192 return {
200 { limit: z.number().optional(), tag: z.string() },
201 async ({ limit, tag }) => {
202 console.log(`${new Date().toISOString()} Fetching sequences data for tag: ${tag}`);
203 const sequences = await fetch("https://www.joshbeckman.org/assets/js/sequences.json").then((res) => res.json());
204 const results = sequences
205 .filter((seq: any) => seq.topic == tag)
206 .slice(0, limit || 100);
207 console.log(`${new Date().toISOString()} Sequences data fetched`);
208 if (results.length == 0) {
209 return {
224 { id: z.string() },
225 async ({ id }) => {
226 console.log(`${new Date().toISOString()} Fetching sequence data for ID: ${id}`);
227 const sequences = await fetch("https://www.joshbeckman.org/assets/js/sequences.json").then((res) => res.json());
228 const sequence = sequences.find((seq: any) => seq.id == id);
229 console.log(`${new Date().toISOString()} Sequence data fetched`);
230 if (!sequence) {
231 return {
244 { query: z.string(), limit: z.number().optional() },
245 async ({ query, limit }) => {
246 console.log(`${new Date().toISOString()} Fetching tags data for search`);
247 const tags = await fetch("https://www.joshbeckman.org/assets/js/tags.json").then((res) => res.json());
248 const tagsIndex = buildTagsIndex(tags);
249 console.log(`${new Date().toISOString()} Tags search index built`);
270 { tags: z.array(z.string()) },
271 async () => {
272 console.log(`${new Date().toISOString()} Fetching tags data`);
273 const sourceTags = await fetch("https://www.joshbeckman.org/assets/js/tags.json")
274 .then((res) => res.json());
275 console.log(`${new Date().toISOString()} Tags data fetched`);
276 const data = sourceTags.filter((tag) => tags.includes(tag.name)).map((tag) => {
277 return `[${tag.name}](${SITE_URL}${tag.url})`;
287 {},
288 async () => {
289 console.log(`${new Date().toISOString()} Fetching tags data`);
290 const tags = await fetch("https://www.joshbeckman.org/assets/js/tags.json")
291 .then((res) => res.json());
292 const data = tags.sort((a, b) => a.name.localeCompare(b.name)).map((tag) => {
293 return tag.name;
294 }).join("\n");
295 console.log(`${new Date().toISOString()} Tags data fetched`);
296 return {
297 content: [{ type: "text", text: data }]
304 { url: z.string() },
305 async ({ url }) => {
306 console.log(`${new Date().toISOString()} Fetching post data for URL: ${url}`);
307 const searchData = await fetch("https://www.joshbeckman.org/assets/js/SearchData.json").then((res) => res.json());
308 const db: Array<Post> = Object.values(searchData).filter(postFilter).map((post) => {
309 post.author_id = post.author_id || "joshbeckman";
312 });
313 const post = db.find((post) => post.url == url || `${SITE_URL}${post.url}` == url);
314 console.log(`${new Date().toISOString()} Post data fetched`);
315 if (!post) {
316 return {
339 console.log(`${new Date().toISOString()} loading search data`);
340 const [searchData, indexCache] = await Promise.all([
341 fetch("https://www.joshbeckman.org/assets/js/SearchData.json").then((res) => res.json()),
342 fetch("https://www.joshbeckman.org/assets/js/lunr-index.json").then((res) => res.json()),
343 ]);
344 console.log(`${new Date().toISOString()} search data loaded`);
452 });
453
454 return toFetchResponse(res);
455 } catch (e) {
456 console.error(e);
503 * This will be exposed as a Val.town HTTP endpoint
504 */
505export default app.fetch;
506

glancerContentAsyncGamemain.tsx2 matches

@glance•Updated 1 month ago
11
12 constructor() {}
13 async fetch(req: Request): Promise<Response> {
14 if (new URL(req.url).pathname === "/robots.txt") {
15 return new Response("User-agent: *\nDisallow: /");
271const sc = new StaticChess();
272
273export default analyticsHandlerWrapper(sc.fetch.bind(sc));

gissue-rolodexREADME.md1 match

@cricks_unmixed4u•Updated 1 month ago
67------------
68
691. Calls `github-api` to fetch issues/PRs updated since the last run (it handles tracking the last execution time internally).
702. For each updated issue/PR, crafts a summary comment and sends a +1 datapoint to your Beeminder goal, with the correct (seconds) timestamp.
71

voicemessagesVoiceRecorder.tsx1 match

@hrev•Updated 1 month ago
145 }
146
147 fetch("/api/voicenotes", {
148 method: "POST",
149 body: formData,

voicemessagesVoicePlayer.tsx4 matches

@hrev•Updated 1 month ago
14
15 useEffect(() => {
16 fetchVoiceNote();
17 }, [voiceNoteId]);
18
19 const fetchVoiceNote = async () => {
20 try {
21 setLoading(true);
22 const response = await fetch(`/api/voicenotes/${voiceNoteId}`);
23 const data = await response.json();
24
32 } catch (err) {
33 setError("Failed to load voice message");
34 console.error("Error fetching voice message:", err);
35 } finally {
36 setLoading(false);

voicemessagesvoicenotes.ts3 matches

@hrev•Updated 1 month ago
24 return c.json({ success: true, voiceNotes });
25 } catch (error) {
26 console.error("Error fetching voice notes:", error);
27 return c.json({ success: true, voiceNotes: [] });
28 }
97 return c.json({ success: true, voiceNote });
98 } catch (error) {
99 console.error("Error fetching voice note:", error);
100 return c.json({ success: false, error: "Failed to fetch voice note" }, 500);
101 }
102});

voicemessagesindex.ts1 match

@hrev•Updated 1 month ago
23app.route("/", staticRoutes);
24
25export default app.fetch;

voicemessagesDashboard.tsx8 matches

@hrev•Updated 1 month ago
9
10 useEffect(() => {
11 fetchVoiceNotes();
12 }, []);
13
14 const fetchVoiceNotes = async () => {
15 try {
16 setLoading(true);
17 const response = await fetch("/api/voicenotes");
18 const data = await response.json();
19
21 setVoiceNotes(data.voiceNotes || []);
22 } else {
23 setError(data.error || "Failed to fetch voice messages");
24 }
25 } catch (err) {
26 setError("Failed to load voice messages");
27 console.error("Error fetching voice messages:", err);
28 } finally {
29 setLoading(false);
120
121 try {
122 const response = await fetch(`/api/voicenotes/${voiceNoteId}`, {
123 method: "DELETE",
124 });
160 <p className="text-red-600 mb-4">{error}</p>
161 <button
162 onClick={fetchVoiceNotes}
163 className="px-6 py-2 bg-blue-600 text-white rounded-md hover:bg-blue-700"
164 >
177 </h2>
178 <button
179 onClick={fetchVoiceNotes}
180 className="px-4 py-2 bg-gray-100 text-gray-700 rounded-md hover:bg-gray-200 text-sm"
181 >

thirdTimerindex.ts1 match

@florian42•Updated 1 month ago
31 return favicon();
32});
33export default app.fetch;
34

thirdTimer.cursorrules3 matches

@florian42•Updated 1 month ago
239
240 // Inject data to avoid extra round-trips
241 const initialData = await fetchInitialData();
242 const dataScript = `<script>
243 window.__INITIAL_DATA__ = ${JSON.stringify(initialData)};
286
2875. **API Design:**
288 - `fetch` handler is the entry point for HTTP vals
289 - Run the Hono app with `export default app.fetch // This is the entry point for HTTP vals`
290
291

manual-fetcher

@miz•Updated 3 days ago

fake-https1 file match

@blazemcworld•Updated 1 week ago
simple proxy to fetch http urls using https