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=677&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"(8835ms)

react-router-hono-starterserver.tsx1 match

@wolf•Updated 1 month ago
44});
45
46export default app.fetch;

react-router-hono-starterroutes.tsx2 matches

@wolf•Updated 1 month ago
3import { useLoaderData, Link, Outlet } from "https://esm.sh/react-router@7";
4
5// provide the full URL so that both the client and server can fetch
6const API_URL = "https://react-router-hono.val.run/api";
7
70
71async function catsLoader () {
72 const data = await fetch(API_URL)
73 .then(res => res.json());
74 return data;

react-router-hono-starterREADME.md1 match

@wolf•Updated 1 month ago
12
13The routes are defined in `routes` and can include data loading and actions.
14The `/about` route includes a loader that fetches data from the `/api` route, which returns a JSON response.
15The About page uses the `useLoaderData` hook to render the data from the loader in the page.
16

pushmain.tsx2 matches

@stevekrouse•Updated 1 month ago
1/** @jsxImportSource npm:hono@3/jsx */
2import { modifyFetchHandler as codeOnValTownBanner } from "https://esm.town/v/andreterron/codeOnValTown";
3import { passwordAuth } from "https://esm.town/v/pomdtr/password_auth";
4import { Hono } from "npm:hono@3";
121
122export default codeOnValTownBanner(
123 passwordAuth(app.fetch, { verifyPassword: verifyToken }),
124);

Jobchatappchat.ts2 matches

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

Jobchatappapp.js16 matches

@bwalya15•Updated 1 month ago
115
116// Job Listings
117const fetchJobs = async () => {
118 try {
119 const response = await fetch('/api/jobs');
120 if (!response.ok) throw new Error('Failed to fetch jobs');
121
122 const jobs = await response.json();
123 renderJobs(jobs);
124 } catch (error) {
125 console.error('Error fetching jobs:', error);
126 jobListings.innerHTML = '<li class="px-4 py-4 sm:px-6 text-center text-red-500">Failed to load job listings</li>';
127 }
169
170 try {
171 const response = await fetch('/api/jobs', {
172 method: 'POST',
173 headers: {
184 // Clear form and refresh job listings
185 jobForm.reset();
186 fetchJobs();
187
188 // Show success message
195
196// Chat functionality
197const fetchChatMessages = async () => {
198 try {
199 const response = await fetch('/api/chat');
200 if (!response.ok) throw new Error('Failed to fetch chat messages');
201
202 const messages = await response.json();
203 renderChatMessages(messages.reverse()); // Reverse to show oldest first
204 } catch (error) {
205 console.error('Error fetching chat messages:', error);
206 chatMessages.innerHTML = '<div class="text-center text-red-500">Failed to load chat messages</div>';
207 }
260
261 try {
262 const response = await fetch('/api/chat', {
263 method: 'POST',
264 headers: {
278 // Clear input and refresh messages
279 chatInput.value = '';
280 fetchChatMessages();
281 } catch (error) {
282 console.error('Error sending message:', error);
311const startPolling = () => {
312 // Poll for new jobs every 30 seconds
313 setInterval(fetchJobs, 30000);
314
315 // Poll for new chat messages every 5 seconds
316 setInterval(fetchChatMessages, 5000);
317};
318
321 setViewSourceLink();
322 loadUsername();
323 fetchJobs();
324 fetchChatMessages();
325 startPolling();
326

Jobchatappindex.ts1 match

@bwalya15•Updated 1 month ago
45
46// Export the Hono app for HTTP vals
47export default app.fetch;

vectorsroutes.tsx2 matches

@jxnblk•Updated 1 month ago
3import { useLoaderData, Link, Outlet } from "https://esm.sh/react-router@7";
4
5// provide the full URL so that both the client and server can fetch
6const API_URL = "https://react-router-hono.val.run/api";
7
70
71async function catsLoader () {
72 const data = await fetch(API_URL)
73 .then(res => res.json());
74 return data;

Jobchatappjobs.ts2 matches

@bwalya15•Updated 1 month ago
10 return c.json(jobPostings);
11 } catch (error) {
12 console.error("Error fetching jobs:", error);
13 return c.json({ error: "Failed to fetch job postings" }, 500);
14 }
15});
21
22/* ── helper: pull one page synchronously ── */
23async function fetchPage(offset: number) {
24 const query = `
25 SELECT
35 `;
36
37 const res = await fetch(
38 `${POSTHOG_HOST}/api/projects/${POSTHOG_PROJECT_ID}/query/`,
39 {
63
64 for (let page = 0; page < MAX_PAGES; page++) {
65 const rows = await fetchPage(page * PAGE_LIMIT);
66 if (rows.length === 0) break;
67

manual-fetcher

@miz•Updated 3 days ago

fake-https1 file match

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