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/$%7Burl%7D?q=fetch&page=4&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 14486 results for "fetch"(1299ms)

WillpersonalWebsitehomepage1 match

@willthereaderโ€ขUpdated 23 hours ago
137app.get("/ImOKTheBullIsDead", ImOKTheBullIsDead);
138
139export default app.fetch;

WillpersonalWebsitepersonalWebsite1 match

@willthereaderโ€ขUpdated 23 hours ago
46app.get("/ImOKTheBullIsDead", ImOKTheBullIsDead);
47
48export default app.fetch;

reactHonoStarterkkindex.ts2 matches

@tengisโ€ขUpdated 23 hours ago
21});
22
23// HTTP vals expect an exported "fetch handler"
24// This is how you "run the server" in Val Town with Hono
25export default app.fetch;

reactHonoStarteindex.ts2 matches

@tengisโ€ขUpdated 23 hours ago
21});
22
23// HTTP vals expect an exported "fetch handler"
24// This is how you "run the server" in Val Town with Hono
25export default app.fetch;

reactHonoStarterindex.ts2 matches

@tengisโ€ขUpdated 23 hours ago
21});
22
23// HTTP vals expect an exported "fetch handler"
24// This is how you "run the server" in Val Town with Hono
25export default app.fetch;

factoid-triviaindex.ts1 match

@bmitchinsonโ€ขUpdated 1 day ago
244});
245
246export default app.fetch;
247

factoid-triviaApp.tsx19 matches

@bmitchinsonโ€ขUpdated 1 day ago
46 }, []);
47
48 const fetchGameState = async () => {
49 try {
50 const response = await fetch("/api/game-state");
51 if (response.ok) {
52 const newGameState = await response.json();
64 }
65 } catch (err) {
66 console.error("Failed to fetch game state:", err);
67 }
68 };
70 const startPolling = () => {
71 if (pollIntervalRef.current) return;
72 pollIntervalRef.current = setInterval(fetchGameState, 2000); // Poll every 2 seconds
73 };
74
85
86 try {
87 const response = await fetch("/api/join", {
88 method: "POST",
89 headers: { "Content-Type": "application/json" },
118
119 try {
120 const response = await fetch("/api/submit-fact", {
121 method: "POST",
122 headers: { "Content-Type": "application/json" },
127
128 if (response.ok) {
129 await fetchGameState(); // Refresh game state
130 } else {
131 setError(data.error || "Failed to submit fact");
144
145 try {
146 const response = await fetch("/api/start-round", {
147 method: "POST",
148 headers: { "Content-Type": "application/json" },
152
153 if (response.ok) {
154 await fetchGameState(); // Refresh game state
155 } else {
156 setError(data.error || "Failed to start round");
171
172 try {
173 const response = await fetch("/api/vote", {
174 method: "POST",
175 headers: { "Content-Type": "application/json" },
184
185 if (response.ok) {
186 await fetchGameState(); // Refresh game state
187 } else {
188 setError(data.error || "Failed to cast vote");
200
201 try {
202 const response = await fetch("/api/reveal", {
203 method: "POST",
204 headers: { "Content-Type": "application/json" },
208
209 if (response.ok) {
210 await fetchGameState(); // Refresh game state
211 } else {
212 setError(data.error || "Failed to reveal answers");
222
223 try {
224 const response = await fetch("/api/skip", {
225 method: "POST",
226 headers: { "Content-Type": "application/json" },
230
231 if (response.ok) {
232 await fetchGameState(); // Refresh game state
233 } else {
234 setError(data.error || "Failed to skip round");
244
245 try {
246 await fetch("/api/leave", {
247 method: "POST",
248 headers: { "Content-Type": "application/json" },
253 setUserVote(null);
254 stopPolling();
255 await fetchGameState();
256 } catch (err) {
257 console.error("Leave error:", err);
272
273 try {
274 const response = await fetch("/api/admin/kick-all", {
275 method: "POST",
276 headers: { "Content-Type": "application/json" },
286
287 // Refresh game state
288 await fetchGameState();
289
290 alert("All players have been kicked and game data cleared.");

factoid-trivia.instructions.md3 matches

@bmitchinsonโ€ขUpdated 1 day 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

reddit-checkerREADME.md4 matches

@sunnyatlightswitchโ€ขUpdated 1 day ago
170### Adjusting Post Limit
171
172Modify the `limit` parameter in the `fetchSubredditPosts` function call:
173
174```typescript
175const posts = await fetchSubredditPosts(subreddit, 50); // Check 50 posts per subreddit instead of 25
176```
177
187
188- โœ… Reddit API authentication working
189- โœ… Post fetching functional across multiple subreddits
190- โœ… Keyword matching operational
191- โœ… Slack notifications configured and tested
225- **API Connection**: โœ… Successful
226- **Authentication**: โœ… Working
227- **Post Fetching**: โœ… Retrieved posts from multiple subreddits
228- **Keyword Matching**: โœ… Found matches with updated keyword list
229- **Multi-Subreddit Support**: โœ… Now monitoring 11 subreddits simultaneously
85 const auth = btoa(`${REDDIT_CLIENT_ID}:${REDDIT_CLIENT_SECRET}`);
86
87 const response = await fetch('https://www.reddit.com/api/v1/access_token', {
88 method: 'POST',
89 headers: {
115
116/**
117 * Fetches recent posts from a subreddit using Reddit API
118 */
119async function fetchSubredditPosts(subreddit: string, limit: number = 25): Promise<RedditPost[]> {
120 try {
121 const accessToken = await getRedditAccessToken();
122 const url = `https://oauth.reddit.com/r/${subreddit}/new?limit=${limit}`;
123
124 const response = await fetch(url, {
125 headers: {
126 'Authorization': `Bearer ${accessToken}`,
136 return data.data.children.map(child => child.data);
137 } catch (error) {
138 console.error(`Error fetching posts from r/${subreddit}:`, error);
139 throw error;
140 }
212 };
213
214 const response = await fetch(SLACK_WEBHOOK_URL, {
215 method: 'POST',
216 headers: {
267
268 try {
269 // Fetch recent posts from this subreddit
270 const posts = await fetchSubredditPosts(subreddit);
271 console.log(`๐Ÿ“ฅ Fetched ${posts.length} posts from r/${subreddit}`);
272 totalPosts += posts.length;
273
302
303 console.log(`\n๐Ÿ“Š Summary across all subreddits:`);
304 console.log(`๐Ÿ“ฅ Total posts fetched: ${totalPosts}`);
305 console.log(`๐Ÿ†• Total new posts: ${totalNewPosts}`);
306 console.log(`โœ… Total matches found: ${allMatchingPosts.length}`);
336 // Send error notification to Slack
337 try {
338 await fetch(SLACK_WEBHOOK_URL, {
339 method: 'POST',
340 headers: {

testWeatherFetcher1 file match

@sjaskeprutโ€ขUpdated 2 days ago

weatherFetcher1 file match

@sjaskeprutโ€ขUpdated 2 days ago