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=864&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 13727 results for "fetch"(6353ms)

project_to_textindex.ts3 matches

@dcm31•Updated 2 months ago
95 if (failedFiles.length > 0) {
96 const failedFilesList = failedFiles.map(f => `'${f.path}': ${f.error}`).join(", ");
97 throw new Error(`Failed to fetch content for files: ${failedFilesList}`);
98 }
99
107});
108
109// HTTP vals expect an exported "fetch handler"
110// This is how you "run the server" in Val Town with Hono
111export default app.fetch;

project_to_textApp.tsx1 match

@dcm31•Updated 2 months ago
11 const onExportClick = async () => {
12 if (name && username) {
13 const response = await fetch(`/text?name=${name}&username=${username}`);
14 const data = await response.text();
15 setText(data);

convivialCopperGamefowlmain.tsx10 matches

@AP123•Updated 2 months ago
4// Endpoint: true
5// Public: false
6import { fetch } from "npm:undici";
7
8/**
9 * Fetches an image from a URL and converts it to base64
10 * @param {string} imageUrl - The URL of the image to fetch
11 * @returns {Promise<{data: string, mimeType: string}>} The base64-encoded image data and MIME type
12 */
13async function fetchImageAsBase64(imageUrl) {
14 const response = await fetch(imageUrl);
15 if (!response.ok) {
16 throw new Error(`Failed to fetch image: ${response.statusText}`);
17 }
18
83 // Handle image input from various sources
84 if (body.imageUrl) {
85 // Fetch and convert Cloudinary URL to base64
86 try {
87 const imageData = await fetchImageAsBase64(body.imageUrl);
88 payload.contents[0].parts.push({
89 inlineData: {
93 });
94 } catch (error) {
95 return new Response(`Error fetching image from URL: ${error.message}`, { status: 400 });
96 }
97 } else if (body.imageData && body.imageMimeType) {
106
107 // Make the request to Gemini API
108 const response = await fetch(url, {
109 method: "POST",
110 headers: {

gamesmain.tsx2 matches

@web•Updated 2 months ago
263
264 // Send request to agent processing endpoint
265 const response = await fetch("/process", {
266 method: "POST",
267 headers: {
1592
1593 if (gameId) {
1594 // Fetch specific game
1595 const game = await db.get(
1596 "SELECT * FROM games WHERE id = ?",

statusmonitor2 matches

@vico•Updated 2 months ago
15 const start = performance.now();
16 try {
17 res = await fetch(url);
18 end = performance.now();
19 status = res.status;
25 } catch (e) {
26 end = performance.now();
27 reason = `couldn't fetch: ${e}`;
28 ok = false;
29 }

reactHonoExampleMessageInput.tsx1 match

@moe•Updated 2 months ago
11
12 try {
13 const response = await fetch("/messages", {
14 method: "POST",
15 headers: { "Content-Type": "application/json" },

reactHonoExampleindex.ts2 matches

@moe•Updated 2 months ago
60});
61
62// HTTP vals expect an exported "fetch handler"
63// This is how you "run the server" in Val Town with Hono
64export default app.fetch;

reactHonoExampleApp.tsx4 matches

@moe•Updated 2 months ago
9 const [messages, setMessages] = React.useState(initialMessages);
10
11 const fetchMessages = async () => {
12 try {
13 const response = await fetch("/messages");
14 const data = await response.json();
15 setMessages(data.reverse());
16 } catch (error) {
17 console.error("Failed to fetch messages", error);
18 }
19 };
23 <h1>💬 Message Board!</h1>
24 <MessageList messages={messages} />
25 <MessageInput onSubmit={fetchMessages} />
26 {thisProjectURL
27 ? (

hatsmain.tsx7 matches

@web•Updated 2 months ago
61 }, [messages]);
62
63 // Fetch available tools on load
64 useEffect(() => {
65 const fetchTools = async () => {
66 try {
67 const response = await fetch('/available-tools');
68 const data = await response.json();
69 setAvailableTools(data.tools);
70 } catch (error) {
71 console.error("Error fetching tools:", error);
72 }
73 };
74
75 fetchTools();
76 }, []);
77
94 try {
95 // Initiate problem solving
96 const response = await fetch('/solve-problem', {
97 method: 'POST',
98 headers: { 'Content-Type': 'application/json' },
162 }).join("\n\n");
163
164 const response = await fetch('/execute-step', {
165 method: 'POST',
166 headers: { 'Content-Type': 'application/json' },

ReadmeRouteAsyncmain.tsx1 match

@g•Updated 2 months ago
14});
15
16export default app.fetch;

FetchBasic2 file matches

@ther•Updated 2 days ago

GithubPRFetcher

@andybak•Updated 5 days ago