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/image-url.jpg%20%22Optional%20title%22?q=fetch&page=1368&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 16245 results for "fetch"(5235ms)

addToLogmain.tsx5 matches

@ejfox•Updated 11 months ago
19
20 useEffect(() => {
21 fetchMessages();
22 }, []);
23
24 const fetchMessages = async () => {
25 const response = await fetch("/messages");
26 const data = await response.json();
27 setMessages(data);
32 if (!newMessage.trim()) return;
33
34 await fetch("/messages", {
35 method: "POST",
36 headers: { "Content-Type": "application/json" },
39
40 setNewMessage("");
41 fetchMessages();
42 };
43

isMyWebsiteDownmain.tsx2 matches

@rareadmin•Updated 11 months ago
14 start = performance.now();
15 try {
16 const res = await fetch(url);
17 end = performance.now();
18 status = res.status;
25 } catch (e) {
26 end = performance.now();
27 reason = `couldn't fetch: ${e}`;
28 ok = false;
29 console.log(`Website down (${url}): ${reason} (${end - start}ms)`);

sqliteExplorerAppmain.tsx4 matches

@lukedenton•Updated 11 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(handler, { verifyPassword: verifyToken }));

valTownUsermain.tsx1 match

@iamseeley•Updated 11 months ago
9 cachedUser = await api('/v1/me', { authenticated: true });
10 } catch (error) {
11 console.error('Error fetching user info:', error);
12 return null;
13 }

apimain.tsx2 matches

@iamseeley•Updated 11 months ago
16
17 while (true) {
18 const resp = await fetch(url);
19 if (!resp.ok) {
20 throw new Error(await resp.text());
33 return { data } as T;
34 }
35 const resp = await fetch(`${API_URL}${path}`, {
36 ...options,
37 headers: {

valTownDataLogsmain.tsx1 match

@iamseeley•Updated 11 months ago
87
88 } catch (error) {
89 console.error('Error fetching user data or inspecting database:', error);
90 }
91}

valTownUserREADME.md1 match

@iamseeley•Updated 11 months ago
6
7### getUserInfo()
8Fetches and caches the user's information.
9- Use case: Retrieving all user details at once.
10```ts

allvalsmain.tsx4 matches

@ejfox•Updated 11 months ago
32 debugMessages.push(`User ID retrieved: ${user.id}`);
33
34 debugMessages.push(`Fetching vals for user ID: ${user.id}`);
35 let vals = [];
36 try {
38 vals.push(val);
39 }
40 debugMessages.push(`Vals fetched successfully. Number of vals: ${vals.length}`);
41 } catch (error) {
42 debugMessages.push(`Error fetching vals: ${error instanceof Error ? error.message : String(error)}`);
43 throw new Error(`Failed to fetch vals for user ID: ${user.id}`);
44 }
45

umbrellaRemindermain.tsx2 matches

@endzel•Updated 11 months ago
1import { email } from "https://esm.town/v/std/email?v=9";
2import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON";
3import { nominatimSearch } from "https://esm.town/v/stevekrouse/nominatimSearch";
4import { weatherGovGrid } from "https://esm.town/v/stevekrouse/weatherGovGrid";
14 lon,
15 });
16 let { properties: { periods } } = await fetchJSON(
17 grid.forecastHourly,
18 );

uptimemain.tsx2 matches

@endzel•Updated 11 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)`);

readwise-instapaper1 file match

@welson•Updated 2 days ago
Fetches my articles from Readwise. Syncs with/ Neon + Instapaper

manual-fetcher

@miz•Updated 2 weeks ago