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/$1?q=fetch&page=21&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 13191 results for "fetch"(3266ms)

Chatindex.ts1 match

@c15r•Updated 1 day ago
19});
20
21export default app.fetch;

ChatmcpTesting.ts4 matches

@c15r•Updated 1 day ago
64
65 try {
66 const response = await fetch(server.url, {
67 method: "POST",
68 headers,
97 };
98 }
99 } catch (fetchError: any) {
100 clearTimeout(timeoutId);
101
102 if (fetchError.name === "AbortError") {
103 return {
104 success: false,
107 }
108
109 throw fetchError;
110 }
111 } catch (error: any) {

weatherindex.ts9 matches

@dukky•Updated 1 day ago
19
20 try {
21 const response = await fetch(
22 `https://api.open-meteo.com/v1/forecast?latitude=${lat}&longitude=${lon}&current=temperature_2m,weather_code,wind_speed_10m,wind_direction_10m,relative_humidity_2m,surface_pressure,visibility,uv_index&hourly=temperature_2m,weather_code,precipitation,wind_speed_10m,wind_direction_10m,relative_humidity_2m&daily=temperature_2m_max,temperature_2m_min,weather_code,precipitation_sum,wind_speed_10m_max,wind_direction_10m_dominant,uv_index_max,sunrise,sunset&timezone=Europe/London`
23 );
68 } catch (error) {
69 console.error("Weather API error:", error);
70 return c.json({ error: "Failed to fetch weather data" }, 500);
71 }
72});
95 const weatherPromises = ukCities.map(async (city) => {
96 try {
97 const response = await fetch(
98 `https://api.open-meteo.com/v1/forecast?latitude=${city.lat}&longitude=${city.lon}&current=temperature_2m,weather_code&timezone=Europe/London`
99 );
113 };
114 } catch (error) {
115 console.error(`Failed to fetch weather for ${city.name}:`, error);
116 return null;
117 }
124 } catch (error) {
125 console.error("Map weather API error:", error);
126 return c.json({ error: "Failed to fetch map weather data" }, 500);
127 }
128});
137 try {
138 // Use Open-Meteo geocoding API with focus on UK
139 const response = await fetch(
140 `https://geocoding-api.open-meteo.com/v1/search?name=${encodeURIComponent(query)}&count=10&language=en&format=json`
141 );
189 // Inject initial UK weather data to avoid extra round-trips
190 try {
191 const ukWeatherResponse = await fetch(
192 "https://api.open-meteo.com/v1/forecast?latitude=54.5&longitude=-2&current=temperature_2m,weather_code,wind_speed_10m,wind_direction_10m,relative_humidity_2m,surface_pressure,visibility,uv_index&hourly=temperature_2m,weather_code,precipitation,wind_speed_10m,wind_direction_10m,relative_humidity_2m&daily=temperature_2m_max,temperature_2m_min,weather_code,precipitation_sum,wind_speed_10m_max,wind_direction_10m_dominant,uv_index_max,sunrise,sunset&timezone=Europe/London"
193 );
210 html = html.replace("</head>", `${dataScript}</head>`);
211 } catch (error) {
212 console.error("Failed to fetch initial weather data:", error);
213 }
214
216});
217
218export default app.fetch;

weatherApp.tsx3 matches

@dukky•Updated 1 day ago
75
76 try {
77 const response = await fetch(`/api/weather?lat=${location.latitude}&lon=${location.longitude}`);
78 if (!response.ok) {
79 throw new Error('Failed to fetch weather data');
80 }
81
84 } catch (err) {
85 setError(err instanceof Error ? err.message : 'An error occurred');
86 console.error('Error fetching weather data:', err);
87 } finally {
88 setLoading(false);

weatherWeatherMap.tsx5 matches

@dukky•Updated 1 day ago
42 });
43
44 // Fetch weather data for map points
45 fetchMapWeatherData();
46
47 return () => {
189 }, [onLocationSelect]);
190
191 const fetchMapWeatherData = async () => {
192 try {
193 setLoading(true);
194 const response = await fetch('/api/weather/map');
195 if (response.ok) {
196 const data = await response.json();
198 }
199 } catch (error) {
200 console.error('Failed to fetch map weather data:', error);
201 } finally {
202 setLoading(false);

weatherLocationSearch.tsx2 matches

@dukky•Updated 1 day ago
44 setIsSearching(true);
45 try {
46 const response = await fetch(`/api/geocoding?q=${encodeURIComponent(query.trim())}`);
47 if (response.ok) {
48 const locations = await response.json();
98 try {
99 // Try to get a readable name for the location using reverse geocoding
100 const response = await fetch(
101 `https://geocoding-api.open-meteo.com/v1/search?latitude=${latitude}&longitude=${longitude}&count=1&language=en&format=json`
102 );

weathergeocoding.ts1 match

@dukky•Updated 1 day ago
14 try {
15 // Use Open-Meteo geocoding API with focus on UK
16 const response = await fetch(
17 `https://geocoding-api.open-meteo.com/v1/search?name=${encodeURIComponent(query)}&count=10&language=en&format=json`
18 );

weatherweather.ts5 matches

@dukky•Updated 1 day ago
14
15 try {
16 const response = await fetch(
17 `https://api.open-meteo.com/v1/forecast?latitude=${lat}&longitude=${lon}&current=temperature_2m,weather_code,wind_speed_10m,wind_direction_10m,relative_humidity_2m,surface_pressure,visibility,uv_index&hourly=temperature_2m,weather_code,precipitation,wind_speed_10m,wind_direction_10m,relative_humidity_2m&daily=temperature_2m_max,temperature_2m_min,weather_code,precipitation_sum,wind_speed_10m_max,wind_direction_10m_dominant,uv_index_max,sunrise,sunset&timezone=Europe/London`
18 );
63 } catch (error) {
64 console.error("Weather API error:", error);
65 return c.json({ error: "Failed to fetch weather data" }, 500);
66 }
67});
91 const weatherPromises = ukCities.map(async (city) => {
92 try {
93 const response = await fetch(
94 `https://api.open-meteo.com/v1/forecast?latitude=${city.lat}&longitude=${city.lon}&current=temperature_2m,weather_code&timezone=Europe/London`
95 );
109 } as MapWeatherPoint;
110 } catch (error) {
111 console.error(`Failed to fetch weather for ${city.name}:`, error);
112 return null;
113 }
120 } catch (error) {
121 console.error("Map weather API error:", error);
122 return c.json({ error: "Failed to fetch map weather data" }, 500);
123 }
124});

statusmonitor2 matches

@sherif_kahala•Updated 1 day ago
17 const start = performance.now();
18 try {
19 res = await fetch(url);
20 end = performance.now();
21 status = res.status;
27 } catch (e) {
28 end = performance.now();
29 reason = `couldn't fetch: ${e}`;
30 ok = false;
31 }

Dopaminedetoxmain.tsx2 matches

@Bernice•Updated 1 day 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({

proxiedfetch1 file match

@jayden•Updated 16 hours ago

fetch-socials4 file matches

@welson•Updated 4 days ago
fetch and archive my social posts