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=203&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"(548ms)

AlwaysHereindex.ts2 matches

@varun1352Updated 1 month ago
33});
34
35// ✅ Export fetch handler
36export default app.fetch;

AlwaysHeregoogleOAuth.ts3 matches

@varun1352Updated 1 month ago
15
16 // Exchange code for tokens
17 const tokenResponse = await fetch("https://oauth2.googleapis.com/token", {
18 method: "POST",
19 headers: { "Content-Type": "application/x-www-form-urlencoded" },
29 const { access_token, id_token } = await tokenResponse.json();
30
31 // Fetch user info
32 const userInfoResponse = await fetch("https://www.googleapis.com/oauth2/v3/userinfo", {
33 headers: { Authorization: `Bearer ${access_token}` },
34 });

AlwaysHererecordings.ts1 match

@varun1352Updated 1 month ago
21});
22
23// 🎙️ GET /api/recordings?uid={uid} - Fetch user recordings
24recordings.get("/", async (c) => {
25 const uid = c.req.query("uid");

AlwaysHerefriends.ts1 match

@varun1352Updated 1 month ago
28});
29
30// ✅ Fetch a user's friends list
31friends.get("/", async (c) => {
32 const uid = c.req.query("uid");

AlwaysHerechat.ts1 match

@varun1352Updated 1 month ago
26});
27
28// 📜 Fetch chat history for a user
29chat.get("/history", async (c) => {
30 try {

frontierScannersite.http.tsx1 match

@wolfUpdated 1 month ago
93
94 useEffect(() => {
95 fetch(API_URL)
96 .then((response) => response.json())
97 .then((data) => {

forky_1742582577934App.tsx1 match

@charmaineUpdated 1 month ago
25 }
26
27 const response = await fetch(`/fork?url=${encodeURIComponent(projectUrl)}`, {
28 method: "POST",
29 headers: {

forky_1742582577934index.ts2 matches

@charmaineUpdated 1 month ago
232});
233
234// HTTP vals expect an exported "fetch handler"
235// This is how you "run the server" in Val Town with Hono
236export default app.fetch;

import_from_githubindex.ts15 matches

@shouserUpdated 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;

forky_1742579787862App.tsx1 match

@shouserUpdated 1 month ago
25 }
26
27 const response = await fetch(`/fork?url=${encodeURIComponent(projectUrl)}`, {
28 method: "POST",
29 headers: {

fetchPaginatedData2 file matches

@nbbaierUpdated 6 days ago

tweetFetcher2 file matches

@nbbaierUpdated 1 week ago