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?q=fetch&page=162&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 10262 results for "fetch"(848ms)

plantprofileApp.tsx10 matches

@seipatiannah1•Updated 1 week ago
25 const [isEditing, setIsEditing] = useState(false);
26
27 // Fetch all plants on component mount
28 useEffect(() => {
29 fetchPlants();
30 }, []);
31
32 const fetchPlants = async () => {
33 try {
34 setIsLoading(true);
35 const response = await fetch("/api/plants");
36 const data = await response.json();
37
39 setPlants(data.data || []);
40 } else {
41 setError(data.error || "Failed to fetch plants");
42 }
43 } catch (err) {
52 try {
53 setIsLoading(true);
54 const response = await fetch(`/api/plants/${id}`);
55 const data = await response.json();
56
58 setSelectedPlant(data.data);
59 } else {
60 setError(data.error || "Failed to fetch plant details");
61 }
62 } catch (err) {
71 try {
72 setIsLoading(true);
73 const response = await fetch("/api/plants", {
74 method: "POST",
75 headers: {
99 try {
100 setIsLoading(true);
101 const response = await fetch(`/api/plants/${id}`, {
102 method: "PUT",
103 headers: {
131 try {
132 setIsLoading(true);
133 const response = await fetch(`/api/plants/${id}`, {
134 method: "DELETE",
135 });

plantprofileplants.ts4 matches

@seipatiannah1•Updated 1 week ago
17 return c.json({ success: true, data: profiles });
18 } catch (error) {
19 console.error("Error fetching plant profiles:", error);
20 return c.json({ success: false, error: "Failed to fetch plant profiles" }, 500);
21 }
22});
37 return c.json({ success: true, data: profile });
38 } catch (error) {
39 console.error("Error fetching plant profile:", error);
40 return c.json({ success: false, error: "Failed to fetch plant profile" }, 500);
41 }
42});

FirstProjectindex.ts1 match

@MiracleSanctuary•Updated 1 week ago
44
45// Export the Hono app
46export default app.fetch;

FirstProjectindex.js21 matches

@MiracleSanctuary•Updated 1 week ago
55};
56
57// Fetch job listings
58const fetchJobs = async () => {
59 try {
60 const response = await fetch('/api/jobs');
61 if (!response.ok) throw new Error('Failed to fetch jobs');
62
63 const jobs = await response.json();
81 `).join('');
82 } catch (error) {
83 console.error('Error fetching jobs:', error);
84 jobListings.innerHTML = '<p class="text-red-500">Failed to load jobs. Please try again later.</p>';
85 }
104 };
105
106 const response = await fetch('/api/jobs', {
107 method: 'POST',
108 headers: {
119 // Reset form and refresh job listings
120 jobForm.reset();
121 await fetchJobs();
122
123 // Show success message
132});
133
134// Fetch chat messages
135const fetchChatMessages = async () => {
136 try {
137 const response = await fetch('/api/chat');
138 if (!response.ok) throw new Error('Failed to fetch chat messages');
139
140 const messages = await response.json();
166 chatMessages.scrollTop = chatMessages.scrollHeight;
167 } catch (error) {
168 console.error('Error fetching chat messages:', error);
169 chatMessages.innerHTML = '<p class="text-red-500">Failed to load messages. Please try again later.</p>';
170 }
188 document.getElementById('message').focus();
189
190 // Fetch messages and start polling
191 fetchChatMessages();
192 startPolling();
193});
202
203 try {
204 const response = await fetch('/api/chat', {
205 method: 'POST',
206 headers: {
218 }
219
220 // Clear input and fetch new messages
221 messageInput.value = '';
222 await fetchChatMessages();
223 } catch (error) {
224 console.error('Error sending message:', error);
231 if (pollingInterval) clearInterval(pollingInterval);
232
233 pollingInterval = setInterval(fetchChatMessages, 3000);
234};
235
243const init = async () => {
244 setViewSourceLink();
245 await fetchJobs();
246
247 // If on chat tab and username is set, fetch messages and start polling
248 if (currentUsername && !chatContent.classList.contains('hidden')) {
249 await fetchChatMessages();
250 startPolling();
251 }

FirstProjectchat.ts2 matches

@MiracleSanctuary•Updated 1 week ago
12 return c.json(messages);
13 } catch (error) {
14 console.error("Error fetching chat messages:", error);
15 return c.json({ error: "Failed to fetch chat messages" }, 500);
16 }
17});

FirstProjectjobs.ts2 matches

@MiracleSanctuary•Updated 1 week ago
11 return c.json(jobPostings);
12 } catch (error) {
13 console.error("Error fetching job postings:", error);
14 return c.json({ error: "Failed to fetch job postings" }, 500);
15 }
16});

lyristmain.ts12 matches

@g•Updated 1 week ago
32
33 try {
34 // 1. Fetch suggestions
35 const suggestUrl = `https://api.lyrics.ovh/suggest/${encodeURIComponent(query)}`;
36 console.log(`Fetching suggestions from: ${suggestUrl}`);
37 const suggestResponse = await fetch(suggestUrl);
38
39 if (!suggestResponse.ok) {
40 console.error(`Error fetching suggestions: ${suggestResponse.status} ${suggestResponse.statusText}`);
41 const errorBody = await suggestResponse.text();
42 console.error(`Error body: ${errorBody}`);
43 return c.json({ error: 'Failed to fetch song suggestions', details: errorBody }, suggestResponse.status);
44 }
45
58 console.log(`Found song: Title - ${actualTitle}, Artist - ${actualArtist}`);
59
60 // 3. Fetch lyrics
61 const lyricsUrl = `https://api.lyrics.ovh/v1/${encodeURIComponent(actualArtist)}/${encodeURIComponent(actualTitle)}`;
62 console.log(`Fetching lyrics from: ${lyricsUrl}`);
63 const lyricsResponse = await fetch(lyricsUrl);
64
65 if (!lyricsResponse.ok) {
66 console.error(`Error fetching lyrics: ${lyricsResponse.status} ${lyricsResponse.statusText}`);
67 const errorBody = await lyricsResponse.text();
68 console.error(`Error body: ${errorBody}`);
72 return c.json({ error: errorJson.error || 'Lyrics not found for this song' }, 404);
73 }
74 return c.json({ error: 'Failed to fetch lyrics', details: errorBody }, lyricsResponse.status);
75 }
76
125});
126
127// Export the fetch handler for the worker
128export default app.fetch;

JobPlatformindex.ts1 match

@MiracleSanctuary•Updated 1 week ago
41
42// This is the entry point for HTTP vals
43export default app.fetch;

JobPlatformapp.js8 matches

@MiracleSanctuary•Updated 1 week ago
85async function loadJobs() {
86 try {
87 const response = await fetch('/api/jobs');
88 if (!response.ok) throw new Error('Failed to fetch jobs');
89
90 const jobs = await response.json();
120 };
121
122 const response = await fetch('/api/jobs', {
123 method: 'POST',
124 headers: {
187async function loadChatMessages() {
188 try {
189 const response = await fetch('/api/chat');
190 if (!response.ok) throw new Error('Failed to fetch chat messages');
191
192 const messages = await response.json();
235 if (lastChatTimestamp) {
236 try {
237 const response = await fetch(`/api/chat/recent?since=${lastChatTimestamp}`);
238 if (!response.ok) throw new Error('Failed to fetch recent messages');
239
240 const newMessages = await response.json();
278
279 try {
280 const response = await fetch('/api/chat', {
281 method: 'POST',
282 headers: {

JobPlatformchat.ts4 matches

@MiracleSanctuary•Updated 1 week ago
12 return c.json(messages);
13 } catch (error) {
14 console.error("Error fetching chat messages:", error);
15 return c.json({ error: "Failed to fetch chat messages" }, 500);
16 }
17});
28 return c.json(messages);
29 } catch (error) {
30 console.error("Error fetching recent chat messages:", error);
31 return c.json({ error: "Failed to fetch recent chat messages" }, 500);
32 }
33});

agentplex-deal-flow-email-fetch1 file match

@anandvc•Updated 4 days ago

proxyFetch2 file matches

@vidar•Updated 1 week ago