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/$2?q=fetch&page=18&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 12867 results for "fetch"(4894ms)

Footballindex.ts36 matches

@Brian250•Updated 13 hours ago
15app.get("/shared/*", c => serveFile(c.req.path, import.meta.url));
16
17// API endpoint to fetch today's matches
18app.get("/api/matches", async (c) => {
19 try {
20 const today = getTodayDateString();
21
22 // Fetch live matches from multiple sources
23 const matches = await fetchTodaysMatches();
24
25 const response: ApiResponse = {
30 return c.json(response);
31 } catch (error) {
32 console.error('Error fetching matches:', error);
33 return c.json({
34 matches: [],
35 lastUpdated: new Date().toISOString(),
36 error: 'Failed to fetch matches'
37 }, 500);
38 }
39});
40
41// API endpoint to fetch matches by date
42app.get("/api/matches/:date", async (c) => {
43 try {
44 const date = c.req.param('date');
45 const matches = await fetchMatchesByDate(date);
46
47 const response: ApiResponse = {
52 return c.json(response);
53 } catch (error) {
54 console.error('Error fetching matches by date:', error);
55 return c.json({
56 matches: [],
57 lastUpdated: new Date().toISOString(),
58 error: 'Failed to fetch matches for date'
59 }, 500);
60 }
67 const sendUpdate = async () => {
68 try {
69 const matches = await fetchTodaysMatches();
70 const liveMatches = matches.filter(m => m.status === 'live');
71
104});
105
106// Function to fetch matches by specific date
107async function fetchMatchesByDate(date: string): Promise<Match[]> {
108 try {
109 // Validate date format
113
114 const matches = await Promise.allSettled([
115 fetchFromFootballAPIByDate(date),
116 fetchFromSportsAPIByDate(date)
117 ]);
118
133 );
134 } catch (error) {
135 console.error('Error fetching matches by date:', error);
136 return [];
137 }
138}
139
140async function fetchFromFootballAPIByDate(date: string): Promise<Match[]> {
141 try {
142 const response = await fetch(`https://api.football-data.org/v4/matches?dateFrom=${date}&dateTo=${date}`, {
143 headers: {
144 'X-Auth-Token': Deno.env.get('FOOTBALL_DATA_API_KEY') || 'demo'
170}
171
172async function fetchFromSportsAPIByDate(date: string): Promise<Match[]> {
173 try {
174 const response = await fetch(`https://www.thesportsdb.com/api/v1/json/3/eventsday.php?d=${date}&s=Soccer`);
175
176 if (!response.ok) {
197}
198
199// Function to fetch today's matches from multiple sources
200async function fetchTodaysMatches(): Promise<Match[]> {
201 try {
202 // Try multiple free APIs for live sports data
203 const matches = await Promise.allSettled([
204 fetchFromFootballAPI(),
205 fetchFromSportsAPI(),
206 fetchFromOpenLigaDB()
207 ]);
208
229 );
230 } catch (error) {
231 console.error('Error in fetchTodaysMatches:', error);
232 return getMockMatches();
233 }
234}
235
236// Fetch from football-data.org (free tier)
237async function fetchFromFootballAPI(): Promise<Match[]> {
238 try {
239 const today = new Date().toISOString().split('T')[0];
240
241 // Using free tier without API key (limited data)
242 const response = await fetch(`https://api.football-data.org/v4/matches?dateFrom=${today}&dateTo=${today}`, {
243 headers: {
244 'X-Auth-Token': Deno.env.get('FOOTBALL_DATA_API_KEY') || 'demo'
270}
271
272// Fetch from free sports API
273async function fetchFromSportsAPI(): Promise<Match[]> {
274 try {
275 const today = new Date().toISOString().split('T')[0];
276
277 // Using free sports API
278 const response = await fetch(`https://www.thesportsdb.com/api/v1/json/3/eventsday.php?d=${today}&s=Soccer`);
279
280 if (!response.ok) {
301}
302
303// Fetch from OpenLigaDB (German football)
304async function fetchFromOpenLigaDB(): Promise<Match[]> {
305 try {
306 const today = new Date();
308
309 // Get current Bundesliga matches
310 const response = await fetch(`https://api.openligadb.de/getmatchdata/bl1/${year}`);
311
312 if (!response.ok) {
409
410 // Inject initial data to avoid extra round-trips
411 const initialMatches = await fetchTodaysMatches();
412 const initialData = {
413 matches: initialMatches,
427});
428
429export default app.fetch;

mini-remix-testrender-client.tsx1 match

@probablycorey•Updated 13 hours ago
59 body.append("_actionName", props.name);
60 console.log(`🌭`, { method: unwrap(props.method) || "POST" });
61 const res = await fetch(form.action || window.location.href, {
62 method: unwrap(props.method) || "POST",
63 body,

mini-remix-testrender-server.tsx1 match

@probablycorey•Updated 13 hours ago
59 body.append("_actionName", props.name);
60 console.log(`🌭`, { method: unwrap(props.method) || "POST" });
61 const res = await fetch(form.action || window.location.href, {
62 method: unwrap(props.method) || "POST",
63 body,

mini-remix-testrender-client.tsx1 match

@probablycorey•Updated 13 hours ago
58 body.append("_actionName", props.name)
59 console.log("🎨", unwrap(props.method) || "POST")
60 const res = await fetch(form.action || window.location.href, {
61 method: unwrap(props.method) || "POST",
62 body,

SampleTwitterAlertmain.tsx1 match

@Darkpearlzz•Updated 13 hours ago
19 : Math.floor((Date.now() - 2 * 24 * 60 * 60 * 1000) / 1000);
20
21 // Fetch and log tweets
22 const response = await socialDataSearch(`${query} since_time:${timeFrame}`);
23 console.log("Response from socialDataSearch:", response);

templateTwitterAlertmain.tsx1 match

@Darkpearlzz•Updated 13 hours ago
19 : Math.floor((Date.now() - 2 * 24 * 60 * 60 * 1000) / 1000);
20
21 // Fetch and log tweets
22 const response = await socialDataSearch(`${query} since_time:${timeFrame}`);
23 console.log("Response from socialDataSearch:", response);

SoccerChat.tsx7 matches

@Brian250•Updated 13 hours ago
28 }, [username]);
29
30 const fetchMessages = async () => {
31 try {
32 setLoading(true);
33 const response = await fetch('/api/chat/messages');
34 if (!response.ok) throw new Error('Failed to fetch messages');
35 const messagesData = await response.json();
36 setMessages(messagesData);
38 } catch (err) {
39 setError('Failed to load messages. Please try again.');
40 console.error('Error fetching messages:', err);
41 } finally {
42 setLoading(false);
45
46 useEffect(() => {
47 fetchMessages();
48 // Poll for new messages every 3 seconds
49 const interval = setInterval(fetchMessages, 3000);
50 return () => clearInterval(interval);
51 }, []);
69 };
70
71 const response = await fetch('/api/chat/messages', {
72 method: 'POST',
73 headers: {

SoccerJobForm.tsx1 match

@Brian250•Updated 13 hours ago
32 };
33
34 const response = await fetch('/api/jobs', {
35 method: 'POST',
36 headers: {

SoccerJobBoard.tsx5 matches

@Brian250•Updated 13 hours ago
10 const [error, setError] = useState<string | null>(null);
11
12 const fetchJobs = async () => {
13 try {
14 setLoading(true);
15 const response = await fetch('/api/jobs');
16 if (!response.ok) throw new Error('Failed to fetch jobs');
17 const jobsData = await response.json();
18 setJobs(jobsData);
20 } catch (err) {
21 setError('Failed to load jobs. Please try again.');
22 console.error('Error fetching jobs:', err);
23 } finally {
24 setLoading(false);
27
28 useEffect(() => {
29 fetchJobs();
30 }, []);
31

templateTwitterAlertmain.tsx1 match

@Victoria1234•Updated 13 hours ago
19 : Math.floor((Date.now() - 2 * 24 * 60 * 60 * 1000) / 1000);
20
21 // Fetch and log tweets
22 const response = await socialDataSearch(`${query} since_time:${timeFrame}`);
23 console.log("Response from socialDataSearch:", response);

fetch-socials4 file matches

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

fetchRssForSubcurrent2 file matches

@ashryanio•Updated 2 days ago