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%20%22Optional%20title%22?q=fetch&page=916&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 13945 results for "fetch"(6817ms)

valflowsketch.ts2 matches

@maxm•Updated 3 months ago
41 return { success: true, functions: rows.rows };
42 } catch (error) {
43 return { success: false, message: `Error fetching functions: ${Deno.inspect(error)}` };
44 }
45}
86 }
87 else if (req.method === "GET") {
88 // Check if we're fetching all functions or a specific path
89 if (url.pathname === "/functions") {
90 const functions = await getAllFunctions();

hardballcitypostComment1 match

@flymaster•Updated 3 months ago
12 const app = await getApp();
13
14 return app.fetch(req);
15}
16

fluxReduxPromain.tsx1 match

@AIWB•Updated 3 months ago
83 setError("");
84 try {
85 const response = await fetch("/generate", {
86 method: "POST",
87 headers: { "Content-Type": "application/json" },

coffeeindex1 match

@ts2004•Updated 3 months ago
5async function servePublicFile(path: string): Promise<Response> {
6 const url = new URL("./public/" + path, import.meta.url);
7 const text = await (await fetch(url, {
8 headers: {
9 "User-Agent": "", // to transpile TS to JS

coffeeindex1 match

@ts2004•Updated 3 months ago
181
182 try {
183 const response = await fetch("/", {
184 method: "POST",
185 body: JSON.stringify({

thrillingMagentaParakeetmain.tsx7 matches

@zoozz•Updated 3 months ago
17
18 useEffect(() => {
19 fetchBalance();
20 }, []);
21
22 const fetchBalance = async () => {
23 try {
24 const response = await fetch('/balance');
25 const data = await response.json();
26 setBalance(data.balance);
27 } catch (err) {
28 setError('Failed to fetch balance');
29 }
30 };
46
47 try {
48 const response = await fetch('/bet', {
49 method: 'POST',
50 headers: { 'Content-Type': 'application/json' },
54 const data = await response.json();
55 setResult(data);
56 fetchBalance(); // Refresh balance after bet
57 } catch (err) {
58 setError('Bet failed. Please try again.');
62 const addFunds = async () => {
63 try {
64 const response = await fetch('/add-funds', { method: 'POST' });
65 const data = await response.json();
66 setBalance(data.balance);

cerebras_coderindex1 match

@asifahmedayaan•Updated 3 months ago
5async function servePublicFile(path: string): Promise<Response> {
6 const url = new URL("./public/" + path, import.meta.url);
7 const text = await (await fetch(url, {
8 headers: {
9 "User-Agent": "", // to transpile TS to JS

cerebras_coderindex1 match

@asifahmedayaan•Updated 3 months ago
181
182 try {
183 const response = await fetch("/", {
184 method: "POST",
185 body: JSON.stringify({

Chatterymain.tsx1 match

@srijanb69•Updated 3 months ago
25
26 try {
27 const response = await fetch("/chat", {
28 method: "POST",
29 body: JSON.stringify({ messages: newMessages }),

blob_adminmain.tsx23 matches

@peterqliu•Updated 3 months ago
234 const [isDragging, setIsDragging] = useState(false);
235
236 const fetchBlobs = useCallback(async () => {
237 setLoading(true);
238 try {
239 const response = await fetch(`/api/blobs?prefix=${encodeKey(searchPrefix)}&limit=${limit}`);
240 const data = await response.json();
241 setBlobs(data);
242 } catch (error) {
243 console.error("Error fetching blobs:", error);
244 } finally {
245 setLoading(false);
248
249 useEffect(() => {
250 fetchBlobs();
251 }, [fetchBlobs]);
252
253 const handleSearch = (e) => {
264 setBlobContentLoading(true);
265 try {
266 const response = await fetch(`/api/blob?key=${encodeKey(clickedBlob.key)}`);
267 const content = await response.text();
268 setSelectedBlob({ ...clickedBlob, key: decodeKey(clickedBlob.key) });
269 setEditContent(content);
270 } catch (error) {
271 console.error("Error fetching blob content:", error);
272 } finally {
273 setBlobContentLoading(false);
278 const handleSave = async () => {
279 try {
280 await fetch(`/api/blob?key=${encodeKey(selectedBlob.key)}`, {
281 method: "PUT",
282 body: editContent,
290 const handleDelete = async (key) => {
291 try {
292 await fetch(`/api/blob?key=${encodeKey(key)}`, { method: "DELETE" });
293 setBlobs(blobs.filter(b => b.key !== key));
294 if (selectedBlob && selectedBlob.key === key) {
307 const key = `${searchPrefix}${file.name}`;
308 formData.append("key", encodeKey(key));
309 await fetch("/api/blob", { method: "POST", body: formData });
310 const newBlob = { key, size: file.size, lastModified: new Date().toISOString() };
311 setBlobs([newBlob, ...blobs]);
315 }
316 }
317 fetchBlobs();
318 };
319
329 try {
330 const fullKey = `${searchPrefix}${key}`;
331 await fetch(`/api/blob?key=${encodeKey(fullKey)}`, {
332 method: "PUT",
333 body: "",
344 const handleDownload = async (key) => {
345 try {
346 const response = await fetch(`/api/blob?key=${encodeKey(key)}`);
347 const blob = await response.blob();
348 const url = window.URL.createObjectURL(blob);
363 if (newKey && newKey !== oldKey) {
364 try {
365 const response = await fetch(`/api/blob?key=${encodeKey(oldKey)}`);
366 const content = await response.blob();
367 await fetch(`/api/blob?key=${encodeKey(newKey)}`, {
368 method: "PUT",
369 body: content,
370 });
371 await fetch(`/api/blob?key=${encodeKey(oldKey)}`, { method: "DELETE" });
372 setBlobs(blobs.map(b => b.key === oldKey ? { ...b, key: newKey } : b));
373 if (selectedBlob && selectedBlob.key === oldKey) {
383 const newKey = `__public/${key}`;
384 try {
385 const response = await fetch(`/api/blob?key=${encodeKey(key)}`);
386 const content = await response.blob();
387 await fetch(`/api/blob?key=${encodeKey(newKey)}`, {
388 method: "PUT",
389 body: content,
390 });
391 await fetch(`/api/blob?key=${encodeKey(key)}`, { method: "DELETE" });
392 setBlobs(blobs.map(b => b.key === key ? { ...b, key: newKey } : b));
393 if (selectedBlob && selectedBlob.key === key) {
402 const newKey = key.slice(9); // Remove "__public/" prefix
403 try {
404 const response = await fetch(`/api/blob?key=${encodeKey(key)}`);
405 const content = await response.blob();
406 await fetch(`/api/blob?key=${encodeKey(newKey)}`, {
407 method: "PUT",
408 body: content,
409 });
410 await fetch(`/api/blob?key=${encodeKey(key)}`, { method: "DELETE" });
411 setBlobs(blobs.map(b => b.key === key ? { ...b, key: newKey } : b));
412 if (selectedBlob && selectedBlob.key === key) {
838});
839
840export default lastlogin((request: Request) => app.fetch(request));

FetchBasic2 file matches

@ther•Updated 4 days ago

GithubPRFetcher

@andybak•Updated 1 week ago