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=217&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 16252 results for "fetch"(2087ms)

blob_adminmain.tsx1 match

@codebyivan•Updated 1 month ago
199});
200
201export default lastlogin((request: Request) => app.fetch(request));

blob_adminapp.tsx22 matches

@codebyivan•Updated 1 month ago
231 const [isDragging, setIsDragging] = useState(false);
232
233 const fetchBlobs = useCallback(async () => {
234 setLoading(true);
235 try {
236 const response = await fetch(`/api/blobs?prefix=${encodeKey(searchPrefix)}&limit=${limit}`);
237 const data = await response.json();
238 setBlobs(data);
239 } catch (error) {
240 console.error("Error fetching blobs:", error);
241 } finally {
242 setLoading(false);
245
246 useEffect(() => {
247 fetchBlobs();
248 }, [fetchBlobs]);
249
250 const handleSearch = (e) => {
261 setBlobContentLoading(true);
262 try {
263 const response = await fetch(`/api/blob?key=${encodeKey(clickedBlob.key)}`);
264 const content = await response.text();
265 setSelectedBlob({ ...clickedBlob, key: decodeKey(clickedBlob.key) });
266 setEditContent(content);
267 } catch (error) {
268 console.error("Error fetching blob content:", error);
269 } finally {
270 setBlobContentLoading(false);
275 const handleSave = async () => {
276 try {
277 await fetch(`/api/blob?key=${encodeKey(selectedBlob.key)}`, {
278 method: "PUT",
279 body: editContent,
287 const handleDelete = async (key) => {
288 try {
289 await fetch(`/api/blob?key=${encodeKey(key)}`, { method: "DELETE" });
290 setBlobs(blobs.filter(b => b.key !== key));
291 if (selectedBlob && selectedBlob.key === key) {
304 const key = `${searchPrefix}${file.name}`;
305 formData.append("key", encodeKey(key));
306 await fetch("/api/blob", { method: "POST", body: formData });
307 const newBlob = { key, size: file.size, lastModified: new Date().toISOString() };
308 setBlobs([newBlob, ...blobs]);
312 }
313 }
314 fetchBlobs();
315 };
316
326 try {
327 const fullKey = `${searchPrefix}${key}`;
328 await fetch(`/api/blob?key=${encodeKey(fullKey)}`, {
329 method: "PUT",
330 body: "",
341 const handleDownload = async (key) => {
342 try {
343 const response = await fetch(`/api/blob?key=${encodeKey(key)}`);
344 const blob = await response.blob();
345 const url = window.URL.createObjectURL(blob);
360 if (newKey && newKey !== oldKey) {
361 try {
362 const response = await fetch(`/api/blob?key=${encodeKey(oldKey)}`);
363 const content = await response.blob();
364 await fetch(`/api/blob?key=${encodeKey(newKey)}`, {
365 method: "PUT",
366 body: content,
367 });
368 await fetch(`/api/blob?key=${encodeKey(oldKey)}`, { method: "DELETE" });
369 setBlobs(blobs.map(b => b.key === oldKey ? { ...b, key: newKey } : b));
370 if (selectedBlob && selectedBlob.key === oldKey) {
380 const newKey = `__public/${key}`;
381 try {
382 const response = await fetch(`/api/blob?key=${encodeKey(key)}`);
383 const content = await response.blob();
384 await fetch(`/api/blob?key=${encodeKey(newKey)}`, {
385 method: "PUT",
386 body: content,
387 });
388 await fetch(`/api/blob?key=${encodeKey(key)}`, { method: "DELETE" });
389 setBlobs(blobs.map(b => b.key === key ? { ...b, key: newKey } : b));
390 if (selectedBlob && selectedBlob.key === key) {
399 const newKey = key.slice(9); // Remove "__public/" prefix
400 try {
401 const response = await fetch(`/api/blob?key=${encodeKey(key)}`);
402 const content = await response.blob();
403 await fetch(`/api/blob?key=${encodeKey(newKey)}`, {
404 method: "PUT",
405 body: content,
406 });
407 await fetch(`/api/blob?key=${encodeKey(key)}`, { method: "DELETE" });
408 setBlobs(blobs.map(b => b.key === key ? { ...b, key: newKey } : b));
409 if (selectedBlob && selectedBlob.key === key) {

LogoReviewserver.ts1 match

@anand_g•Updated 1 month ago
37
38// This is the entry point for HTTP vals
39export default app.fetch;

reactHonoStarterApp.tsx6 matches

@krishna•Updated 1 month ago
13 const [loading, setLoading] = useState(true);
14
15 const fetchClimate = async () => {
16 setLoading(true);
17 try {
18 const response = await fetch("/climate");
19 const data = await response.text();
20 setClimate(data);
21 } catch (error) {
22 console.error("Error fetching climate:", error);
23 setClimate("Unable to fetch climate data");
24 } finally {
25 setLoading(false);
28
29 useEffect(() => {
30 fetchClimate();
31 }, []);
32
38 {loading ? "Loading climate..." : climate}
39 </div>
40 <button onClick={fetchClimate} disabled={loading} style={{ marginBottom: "20px" }}>
41 {loading ? "Updating..." : "Update Climate"}
42 </button>

api_ianmenethil_commain.tsx1 match

@ianmenethil•Updated 1 month ago
58 await initializeRoutes();
59 }
60 return await app.fetch(request);
61 } catch (error) {
62 console.error("Server Error:", error);
438console.log(\`📚 API Documentation: http://localhost:\${port}/docs\`);
439
440Deno.serve({ port }, app.fetch);
441`;
442 }

api_ianmenethil_comfix-imports.ts1 match

@ianmenethil•Updated 1 month ago
41 'lodash': 'https://esm.sh/lodash',
42 'axios': 'https://esm.sh/axios',
43 'node-fetch': 'https://esm.sh/node-fetch'
44 };
45

autonomous-valtools.tsx3 matches

@ianmenethil•Updated 1 month ago
94});
95
96export const webFetchTool = tool({
97 description: "Use this tool to fetch the content of a website. Returns the content as plain text.",
98 parameters: z.object({
99 url: z.string().describe("Url to download"),
136 }),
137 execute: async ({ city }) => {
138 const result = await fetch(`https://wttr.in/${city}?format=j1`);
139 return result.json();
140 },

autonomous-valREADME.md1 match

@ianmenethil•Updated 1 month ago
26};
27
28const response = await fetch("https://<your-val-id>.web.val.run/", {
29 method: "POST",
30 headers: {

autonomous-valdemo.tsx1 match

@ianmenethil•Updated 1 month ago
78 // Return error as HTML
79 return new Response(
80 generateHtmlPage(objective, null, `Failed to fetch results: ${error.message}`),
81 {
82 headers: {

readwise-instapaper1 file match

@welson•Updated 2 days ago
Fetches my articles from Readwise. Syncs with/ Neon + Instapaper

manual-fetcher

@miz•Updated 2 weeks ago