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/$1?q=fetch&page=7&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 10960 results for "fetch"(1878ms)

untitled-2795main.tsx3 matches

@notpickard•Updated 7 hours ago
1import axios from "axios";
2async function fetchUsers() {
3 try {
4 const response = await axios.get("https://jsonplaceholder.typicode.com/users");
7 console.log(users);
8 } catch (error) {
9 console.error("Error fetching users:", error.message);
10 }
11}
12fetchUsers();

Chatindex.ts1 match

@c15r•Updated 8 hours ago
18});
19
20export default app.fetch;

endpointsget_vals_endpoints.tsx3 matches

@chadparker•Updated 8 hours ago
11
12 // Get my vals using the authenticated /me/vals endpoint
13 const valsResponse = await fetch("https://api.val.town/v2/me/vals", {
14 headers: {
15 "Authorization": `Bearer ${apiKey}`,
22 console.log("API Error response:", errorText);
23 throw new Error(
24 `Failed to fetch vals: ${valsResponse.status} ${valsResponse.statusText}. Response: ${errorText}`,
25 );
26 }
43 try {
44 // Use the files API to get the actual file structure
45 const filesResponse = await fetch(
46 `https://api.val.town/v2/vals/${val.id}/files?path=&recursive=true&limit=100`,
47 {

endpointsREADME.md2 matches

@chadparker•Updated 8 hours ago
3### status:
4
5- [x] fetch my vals
6- [x] loop through vals
7- [x] look at each val's file list to find endpoints.tsx
10- [ ] read each matching val's endpoints file
11- [ ] format output
12- [ ] fetch it from cloudflare
13- [ ] implement caching
14

saulyteindex.tsx6 matches

@laurynas•Updated 8 hours ago
57
58 // Get location first
59 const locationResponse = await fetch("/api/location");
60 const locationData = await locationResponse.json();
61 setLocation(locationData);
62
63 // Then get weather data
64 await fetchWeatherData(locationData.lat, locationData.lon);
65 } catch (err) {
66 setError("Failed to load weather data");
70 };
71
72 const fetchWeatherData = async (lat: number, lon: number) => {
73 const response = await fetch(`/api/weather?lat=${lat}&lon=${lon}`);
74 const data = await response.json();
75
92
93 if (coords.length === 2 && !isNaN(coords[0]) && !isNaN(coords[1])) {
94 await fetchWeatherData(coords[0], coords[1]);
95 setLocation({
96 lat: coords[0],
103 }
104 } catch (err) {
105 setError("Failed to fetch weather for this location");
106 } finally {
107 setLoading(false);

MCPApp.tsx1 match

@c15r•Updated 8 hours ago
94
95 // Call Anthropic API
96 const response = await fetch("https://api.anthropic.com/v1/messages", {
97 method: "POST",
98 headers: {

MCPindex.ts1 match

@c15r•Updated 8 hours ago
236
237// This is the entry point for HTTP vals
238export default app.fetch;

saulyteindex.ts5 matches

@laurynas•Updated 8 hours ago
1import { Hono } from "https://esm.sh/hono@3.11.7";
2import { readFile, serveFile } from "https://esm.town/v/std/utils@85-main/index.ts";
3import { fetchWeatherApi } from "https://esm.sh/openmeteo";
4
5const app = new Hono();
29
30 try {
31 const responses = await fetchWeatherApi("https://api.open-meteo.com/v1/forecast", params);
32 const response = responses[0];
33
81 return c.json(processedData);
82 } catch (error) {
83 return c.json({ error: "Failed to fetch weather data", details: error.message }, 500);
84 }
85});
90
91 try {
92 const response = await fetch(`http://ip-api.com/json/${ip}`);
93 const data = await response.json();
94
186}
187
188export default app.fetch;

stevensDemosendDailyBrief.ts1 match

@sachi•Updated 8 hours ago
135 const lastSunday = today.startOf("week").minus({ days: 1 });
136
137 // Fetch relevant memories using the utility function
138 const memories = await getRelevantMemories();
139

stevensDemoNotebookView.tsx12 matches

@sachi•Updated 8 hours ago
67 const [currentPage, setCurrentPage] = useState(1);
68
69 const fetchMemories = useCallback(async () => {
70 setLoading(true);
71 setError(null);
72 try {
73 const response = await fetch(API_BASE);
74 if (!response.ok) {
75 throw new Error(`HTTP error! status: ${response.status}`);
78 setMemories(data);
79 } catch (e) {
80 console.error("Failed to fetch memories:", e);
81 setError(e.message || "Failed to fetch memories.");
82 } finally {
83 setLoading(false);
86
87 useEffect(() => {
88 fetchMemories();
89 }, [fetchMemories]);
90
91 const handleAddMemory = async (e: React.FormEvent) => {
100
101 try {
102 const response = await fetch(API_BASE, {
103 method: "POST",
104 headers: { "Content-Type": "application/json" },
112 setNewMemoryTags("");
113 setShowAddForm(false);
114 await fetchMemories();
115 } catch (e) {
116 console.error("Failed to add memory:", e);
123
124 try {
125 const response = await fetch(`${API_BASE}/${id}`, {
126 method: "DELETE",
127 });
129 throw new Error(`HTTP error! status: ${response.status}`);
130 }
131 await fetchMemories();
132 } catch (e) {
133 console.error("Failed to delete memory:", e);
155
156 try {
157 const response = await fetch(`${API_BASE}/${editingMemory.id}`, {
158 method: "PUT",
159 headers: { "Content-Type": "application/json" },
164 }
165 setEditingMemory(null);
166 await fetchMemories();
167 } catch (e) {
168 console.error("Failed to update memory:", e);

HN-fetch-call3 file matches

@ImGqb•Updated 18 hours ago
fetch HackerNews by API

FRAMERFetchBasic1 file match

@bresnik•Updated 2 days ago