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=199&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 2746 results for "fetch"(428ms)

GitHubSyncindex1 match

@ka12m•Updated 1 month ago
22app.post("/deploy", verifyGitHubSignature(GITHUB_WEBHOOK_SECRET), deploy);
23
24export default app.fetch;

ExpenseTrackerExpense8 matches

@AryanChau0310•Updated 1 month ago
18 const [category, setCategory] = useState("");
19
20 // Fetch expenses from server on component mount
21 useEffect(() => {
22 fetchExpenses();
23 }, []);
24
25 // Function to fetch expenses from server
26 const fetchExpenses = async () => {
27 try {
28 const response = await fetch("/expenses");
29 const data = await response.json();
30 setExpenses(data);
31 } catch (error) {
32 console.error("Failed to fetch expenses", error);
33 }
34 };
46
47 try {
48 const response = await fetch("/add-expense", {
49 method: "POST",
50 headers: { "Content-Type": "application/json" },
53
54 if (response.ok) {
55 fetchExpenses(); // Refresh expenses list
56 // Reset form
57 setDescription("");

trAIderAgentindex.ts1 match

@kamalnrf•Updated 1 month ago
31});
32
33export default app.fetch;

openTownieMadeThis5index.ts2 matches

@charmaine•Updated 1 month ago
203});
204
205// HTTP vals expect an exported "fetch handler"
206// This is how you "run the server" in Val Town with Hono
207export default app.fetch;

reactHonoStarter_1742759574740index.ts2 matches

@charmaine•Updated 1 month ago
24});
25
26// HTTP vals expect an exported "fetch handler"
27// This is how you "run the server" in Val Town with Hono
28export default app.fetch;

newjxnblkREADME.md1 match

@charmaine•Updated 1 month ago
42## Running the Project
43
44This project is designed to run on Val Town. The entry point is the `app.fetch` export in `backend/index.ts`.

newjxnblkindex.ts1 match

@charmaine•Updated 1 month ago
27
28// This is the entry point for HTTP vals
29export default app.fetch;

trAIderAgentsearchFinancialInfo.ts4 matches

@kamalnrf•Updated 1 month ago
6async function processResult(result) {
7 try {
8 // Try to fetch the actual webpage content
9 const contentResponse = await fetch(result.link, {
10 headers: {
11 "User-Agent":
14 signal: AbortSignal.timeout(10000),
15 }).catch(err => {
16 console.log(`Failed to fetch ${result.link}: ${err.message}`);
17 return null;
18 });
58 };
59 } catch (error) {
60 console.error(`Error fetching content for ${result.link}:`, error);
61 return {
62 ...result,

import_from_githubindex.ts15 matches

@charmaine•Updated 1 month ago
62
63 // Get all files from GitHub repo
64 console.log("Fetching files from GitHub");
65 try {
66 const files = await fetchGitHubRepoContents(owner, repo);
67 console.log("Files fetched:", files.length);
68
69 // Create files in Val.town project
122}
123
124// Fetch all files and their content from a GitHub repository
125async function fetchGitHubRepoContents(owner: string, repo: string, path: string = "") {
126 const files: Array<{
127 path: string;
134 // GitHub API URL for repo contents
135 const apiUrl = `https://api.github.com/repos/${owner}/${repo}/contents/${path}`;
136 console.log(`Fetching from: ${apiUrl}`);
137
138 const response = await fetch(apiUrl, {
139 headers: {
140 "Accept": "application/vnd.github.v3+json",
154 for (const item of items) {
155 if (item.type === "file") {
156 // Fetch file content
157 let content;
158 if (item.download_url) {
159 const contentResponse = await fetch(item.download_url);
160 if (contentResponse.ok) {
161 content = await contentResponse.text();
162 } else {
163 console.error(`Failed to fetch content for ${item.path}: ${contentResponse.status}`);
164 content = "";
165 }
178 });
179 } else if (item.type === "dir") {
180 // Recursively fetch contents of subdirectories
181 const subFiles = await fetchGitHubRepoContents(owner, repo, item.path);
182 files.push(...subFiles);
183 }
186 return files;
187 } catch (error) {
188 console.error(`Error fetching GitHub contents for ${owner}/${repo}/${path}:`, error);
189 throw error;
190 }
388});
389
390// HTTP vals expect an exported "fetch handler"
391// This is how you "run the server" in Val Town with Hono
392export default app.fetch;

import_from_githubApp.tsx1 match

@charmaine•Updated 1 month ago
25 }
26
27 const response = await fetch(`/import-github?url=${encodeURIComponent(projectUrl)}`, {
28 method: "POST",
29 headers: {

fetchPaginatedData2 file matches

@nbbaier•Updated 6 days ago

tweetFetcher2 file matches

@nbbaier•Updated 1 week ago