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=227&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 13595 results for "fetch"(1974ms)

untitled-8502index.ts1 match

@clarejoan•Updated 6 days ago
33});
34
35export default app.fetch;

untitled-8502api.ts4 matches

@clarejoan•Updated 6 days ago
33 return c.json(companies);
34 } catch (error) {
35 console.error("Error fetching companies:", error);
36 return c.json({ error: "Failed to fetch companies" }, 500);
37 }
38});
55 return c.json(company);
56 } catch (error) {
57 console.error("Error fetching company:", error);
58 return c.json({ error: "Failed to fetch company" }, 500);
59 }
60});

crypto-web-appindex.ts13 matches

@umar_ndungo_tech•Updated 6 days ago
20 // Inject initial data to avoid extra round-trips
21 try {
22 const initialCoins = await fetchCoins(20);
23 const dataScript = `<script>
24 window.__INITIAL_DATA__ = ${JSON.stringify({ coins: initialCoins })};
26 html = html.replace("</head>", `${dataScript}</head>`);
27 } catch (error) {
28 console.error("Failed to fetch initial data:", error);
29 }
30
38 try {
39 const limit = Math.min(parseInt(c.req.query("limit") || "50"), 250);
40 const coins = await fetchCoins(limit);
41 return c.json(coins);
42 } catch (error) {
43 console.error("Error fetching coins:", error);
44 return c.json({ error: "Failed to fetch cryptocurrency data" }, 500);
45 }
46});
52 const days = c.req.query("days") || "7";
53
54 const chartData = await fetchChartData(coinId, days);
55 return c.json(chartData);
56 } catch (error) {
57 console.error("Error fetching chart data:", error);
58 return c.json({ error: "Failed to fetch chart data" }, 500);
59 }
60});
62// Helper functions
63
64async function fetchCoins(limit: number = 50): Promise<CryptoCoin[]> {
65 const response = await fetch(
66 `https://api.coingecko.com/api/v3/coins/markets?vs_currency=usd&order=market_cap_desc&per_page=${limit}&page=1&sparkline=false&price_change_percentage=24h,7d,30d`
67 );
74}
75
76async function fetchChartData(coinId: string, days: string): Promise<ChartData> {
77 // Add interval parameter for better data granularity
78 let interval = '';
84 }
85
86 const response = await fetch(
87 `https://api.coingecko.com/api/v3/coins/${coinId}/market_chart?vs_currency=usd&days=${days}${interval}`
88 );
97}
98
99export default app.fetch;

crypto-web-appCryptoChart.tsx5 matches

@umar_ndungo_tech•Updated 6 days ago
42
43 useEffect(() => {
44 fetchChartData(selectedTimeRange);
45 }, [coin.id, selectedTimeRange]);
46
47 const fetchChartData = async (timeRange: TimeRange) => {
48 try {
49 setLoading(true);
50 setError(null);
51
52 const response = await fetch(`/api/coins/${coin.id}/chart?days=${timeRange}`);
53 if (!response.ok) {
54 throw new Error('Failed to fetch chart data');
55 }
56
247 <p className="text-red-600 mb-4">{error}</p>
248 <button
249 onClick={() => fetchChartData(selectedTimeRange)}
250 className="bg-blue-500 hover:bg-blue-600 text-white px-4 py-2 rounded-lg transition-colors"
251 >

crypto-web-appApp.tsx6 matches

@umar_ndungo_tech•Updated 6 days ago
22
23 useEffect(() => {
24 // Use initial data if available, otherwise fetch
25 if (window.__INITIAL_DATA__?.coins) {
26 setCoins(window.__INITIAL_DATA__.coins);
27 setLoading(false);
28 } else {
29 fetchCoins();
30 }
31 }, []);
32
33 const fetchCoins = async () => {
34 try {
35 setLoading(true);
36 setError(null);
37 const response = await fetch('/api/coins?limit=50');
38 if (!response.ok) {
39 throw new Error('Failed to fetch cryptocurrency data');
40 }
41 const data = await response.json();
75 <p className="text-gray-600 mb-4">{error}</p>
76 <button
77 onClick={fetchCoins}
78 className="bg-blue-500 hover:bg-blue-600 text-white px-6 py-2 rounded-lg transition-colors"
79 >

crypto-web-appREADME.md2 matches

@umar_ndungo_tech•Updated 6 days ago
33
34- `GET /` - Serves the main application
35- `GET /api/coins` - Fetches list of cryptocurrencies
36- `GET /api/coins/:id/chart` - Fetches chart data for a specific coin
37- `GET /frontend/*` - Serves frontend assets
38- `GET /shared/*` - Serves shared utilities

Jobindex.ts1 match

@JayB•Updated 6 days ago
35
36// This is the entry point for HTTP vals
37export default app.fetch;

JobChatRoom.tsx7 matches

@JayB•Updated 6 days ago
16 };
17
18 const fetchMessages = async () => {
19 try {
20 setLoading(true);
21 const response = await fetch('/api/chat/messages');
22 const result: ApiResponse<ChatMessage[]> = await response.json();
23
26 setError(null);
27 } else {
28 setError(result.error || 'Failed to fetch messages');
29 }
30 } catch (err) {
31 setError('Failed to fetch messages');
32 } finally {
33 setLoading(false);
51 };
52
53 const response = await fetch('/api/chat/messages', {
54 method: 'POST',
55 headers: {
77
78 useEffect(() => {
79 fetchMessages();
80
81 // Load saved username
86
87 // Poll for new messages every 5 seconds
88 const interval = setInterval(fetchMessages, 5000);
89 return () => clearInterval(interval);
90 }, []);

JobJobForm.tsx1 match

@JayB•Updated 6 days ago
25
26 try {
27 const response = await fetch('/api/jobs', {
28 method: 'POST',
29 headers: {

JobJobBoard.tsx6 matches

@JayB•Updated 6 days 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 const result: ApiResponse<Job[]> = await response.json();
17
20 setError(null);
21 } else {
22 setError(result.error || 'Failed to fetch jobs');
23 }
24 } catch (err) {
25 setError('Failed to fetch jobs');
26 } finally {
27 setLoading(false);
40
41 try {
42 const response = await fetch(`/api/jobs/${jobId}`, {
43 method: 'DELETE'
44 });
57
58 useEffect(() => {
59 fetchJobs();
60 }, []);
61

FetchBasic2 file matches

@ther•Updated 13 hours ago

GithubPRFetcher

@andybak•Updated 3 days ago