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/$%7Burl%7D?q=fetch&page=1105&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 13280 results for "fetch"(5559ms)

68});
69
70export default app.fetch;
71
35 }
36
37 // Fetch all comments from the database
38 const comments = await sqlite.all("SELECT content, created_at FROM comments ORDER BY created_at DESC");
39
21const app = new Hono();
22
23// Helper function to fetch all comments from the database
24async function fetchComments() {
25 const result = await sqlite.execute(`SELECT * FROM comments ORDER BY timestamp DESC`);
26 return result.rows;
29// Main route: serves the HTML form and displays comments
30app.get("/", async (c) => {
31 const comments = await fetchComments();
32 const commentsHTML = comments.map(
33 (row) => `<div><strong>${row[1]}</strong> (${row[3]}): <p>${row[2]}</p></div>`
76});
77
78// Export the fetch handler to be used by the runtime
79export default app.fetch;
80
64});
65
66export default app.fetch;
67
53});
54
55export default app.fetch;
56

valPreviewmain.tsx9 matches

@iamseeley•Updated 10 months ago
1export async function fetchVal(valId: string) {
2 try {
3 const response = await fetch(`https://api.val.town/v1/vals/${valId}`);
4 if (!response.ok) {
5 console.error(`Error fetching val with ID ${valId}:`, response.statusText);
6 return null;
7 }
8 return await response.json();
9 } catch (fetchError) {
10 console.error(`Network error fetching val ${valId}:`, fetchError);
11 return null;
12 }
15export async function evalCode(code: string) {
16 try {
17 const response = await fetch(`https://api.val.town/v1/eval`, {
18 method: 'POST',
19 headers: {
40 console.log(`Code evaluation result:`, result);
41 return { result };
42 } catch (fetchError) {
43 console.error(`Network error evaluating code:`, fetchError);
44 return { error: 'Network error: Unable to evaluate code' };
45 }
104
105export function injectValContent(valId: string, elementId: string) {
106 return fetchVal(valId).then(data => {
107 if (data) {
108 const valElement = document.getElementById(elementId);

examain.tsx1 match

@yawnxyz•Updated 10 months ago
31
32// const app = new Hono();
33// export default app.fetch;
34
35
90});
91
92export default app.fetch;
93
61});
62
63export default app.fetch;
64

btcmain.tsx3 matches

@park•Updated 10 months ago
12 try {
13 const [priceResponse, historyResponse] = await Promise.all([
14 fetch(`https://api.coingecko.com/api/v3/simple/price?ids=bitcoin&vs_currencies=${CONFIG.COIN_GECKO_CURRENCY}`),
15 fetch(
16 `https://api.coingecko.com/api/v3/coins/bitcoin/market_chart?vs_currency=${CONFIG.COIN_GECKO_CURRENCY}&days=${CONFIG.COIN_GECKO_DAYS}&interval=daily`,
17 ),
82
83function BitcoinData({ data }) {
84 if (!data) return <p>Failed to fetch Bitcoin data.</p>;
85
86 const supportPrices = generateSupportPrices(data.currentPrice);

GithubPRFetcher

@andybak•Updated 14 hours ago

proxiedfetch1 file match

@jayden•Updated 1 day ago