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=505&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 15238 results for "fetch"(5437ms)

Towniefetch.ts5 matches

@downchuck_gmail_com•Updated 1 month ago
11 * Creates a tool for making HTTP requests to vals in a Val Town project
12 */
13export const makeFetchTool = (
14 { bearerToken, project, branch_id }: { bearerToken?: string; project?: any; branch_id?: string } = {},
15) =>
16 tool({
17 name: "fetch",
18 description: "Make an HTTP request to a Val Town val and return the response. Useful for testing HTTP vals.",
19 parameters: z.object({
68 return {
69 type: "error",
70 message: `Error fetching val at path '${valPath}': ${error.message}`,
71 };
72 }
83 return {
84 type: "error",
85 message: `The val at path '${valPath}' is not an HTTP val. Only HTTP vals can be called with fetch.`,
86 };
87 }
111 let response;
112 try {
113 response = await fetch(valEndpoint + urlPath, options);
114 } catch (error: any) {
115 // Return error information

Townie.cursorrules3 matches

@downchuck_gmail_com•Updated 1 month ago
239
240 // Inject data to avoid extra round-trips
241 const initialData = await fetchInitialData();
242 const dataScript = `<script>
243 window.__INITIAL_DATA__ = ${JSON.stringify(initialData)};
286
2875. **API Design:**
288 - `fetch` handler is the entry point for HTTP vals
289 - Run the Hono app with `export default app.fetch // This is the entry point for HTTP vals`
290
291

TownieChatRouteSingleColumn.tsx6 matches

@downchuck_gmail_com•Updated 1 month ago
49 files={project.data?.files}
50 branchId={branchId}
51 refetch={project.refetch}
52 />
53 </ProjectContext>
59 files,
60 branchId,
61 refetch,
62}: {
63 project: any;
64 files: any[];
65 branchId: string;
66 refetch: () => void;
67}) {
68 const [images, setImages] = useState<(string|null)[]>([]);
93 if (!messages?.length) return;
94 let last = messages.at(-1);
95 if (shouldRefetch(last)) {
96 refetch();
97 }
98 }, [messages]);
168}
169
170function shouldRefetch (message) {
171 for (let i = 0; i < message?.parts?.length; i++) {
172 let part = message.parts[i];

TownieBranchSelect.tsx1 match

@downchuck_gmail_com•Updated 1 month ago
32 return;
33 }
34 branches.refetch();
35 if (res?.branch?.id) {
36 navigate(`/chat/${projectId}/branch/${res.branch.id}`);
79 const startTime = Date.now();
80
81 const response = await fetch('https://openrouter.ai/api/v1/chat/completions', {
82 method: 'POST',
83 headers: {

con-juanindex.html9 matches

@Downchuck•Updated 1 month ago
485 try {
486 // Get all sessions first
487 const response = await fetch('/chat-api', {
488 method: 'POST',
489 headers: {
500 // Delete each session
501 for (const session of data.data) {
502 await fetch('/chat-api', {
503 method: 'POST',
504 headers: {
654 if (state.privacyMode === 'database') {
655 // Load from server database
656 const response = await fetch('/chat-api', {
657 method: 'POST',
658 headers: {
757 try {
758 if (state.privacyMode === 'database') {
759 await fetch('/chat-api', {
760 method: 'POST',
761 headers: {
794 if (state.privacyMode === 'database') {
795 // Load from server
796 const response = await fetch('/chat-api', {
797 method: 'POST',
798 headers: {
884 try {
885 if (state.privacyMode === 'database') {
886 await fetch('/chat-api', {
887 method: 'POST',
888 headers: {
1013 if (selectedMode === 'database') {
1014 // Create on server
1015 const response = await fetch('/chat-api', {
1016 method: 'POST',
1017 headers: {
1147 try {
1148 if (state.privacyMode === 'database') {
1149 await fetch('/chat-api', {
1150 method: 'POST',
1151 headers: {
1277 if (state.privacyMode === 'database') {
1278 // Send to server for processing
1279 const response = await fetch('/chat-api', {
1280 method: 'POST',
1281 headers: {

Tindex.ts1 match

@Shaban111•Updated 1 month ago
23});
24
25export default app.fetch;

petitPrincedocumentation.html1 match

@smirfolio•Updated 1 month ago
124 <div>
125 <h3 class="text-xl font-medium text-blue-300">1. Article Extraction</h3>
126 <p class="mt-1">When you submit a URL, Petit Prince fetches the article content and extracts relevant images.</p>
127 </div>
128 <div>

petitPrinceindex.html2 matches

@smirfolio•Updated 1 month ago
316
317 try {
318 const response = await fetch("/api/summarize", {
319 method: "POST",
320 headers: { "Content-Type": "application/json" },
379 blogLink.href = "#";
380 blogLink.style.pointerEvents = "none";
381 const response = await fetch("/api/generate-blog", {
382 method: "POST",
383 headers: { "Content-Type": "application/json" },

petitPrinceblogs.html7 matches

@smirfolio•Updated 1 month ago
96
97 <script>
98 // Fetch and display all saved blogs
99 async function fetchBlogs() {
100 try {
101 const response = await fetch("/api/blogs");
102
103 if (!response.ok) {
104 throw new Error("Failed to fetch blogs");
105 }
106
162 });
163 } catch (error) {
164 console.error("Error fetching blogs:", error);
165 document.getElementById("blogs-list").innerHTML = `
166 <div class="bg-opacity-80 bg-gray-800 p-6 rounded-lg shadow-lg text-center">
167 <p class="text-xl text-red-400">Error loading blogs</p>
168 <p class="mt-2">${error.message}</p>
169 <button onclick="fetchBlogs()" class="button inline-block mt-4" style="max-width: 200px;">Try Again</button>
170 </div>
171 `;
174
175 // Load blogs when page loads
176 document.addEventListener("DOMContentLoaded", fetchBlogs);
177 </script>
178 </body>

fake-https1 file match

@blazemcworld•Updated 6 days ago
simple proxy to fetch http urls using https

testWeatherFetcher1 file match

@sjaskeprut•Updated 2 weeks ago