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/$%7BsvgDataUrl%7D?q=fetch&page=5&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 14071 results for "fetch"(3313ms)

honoExamplemain.tsx1 match

@dswbx•Updated 15 hours ago
8await app.build();
9
10export default app.fetch;

untitled-3218main.tsx1 match

@dswbx•Updated 15 hours ago
4app.get("/", (c) => c.text("Hello world!"));
5app.get("/yeah", (c) => c.text("Routing!"));
6export default app.fetch;

untitled-9417main.ts1 match

@dswbx•Updated 15 hours ago
7})
8
9export default app.fetch
Plantfo

PlantfoREADME.md1 match

@Llad•Updated 15 hours ago
46
47### GET /plant/:name
48Returns detailed information about a specific plant. If the plant information is already cached, returns the cached response immediately. Otherwise, fetches new information from OpenAI and caches it for future requests.
49
50**Parameters:**
Plantfo

Plantfotest.html2 matches

@Llad•Updated 15 hours ago
109 <div class="animate-spin rounded-full h-4 w-4 border-b-2 border-blue-600 mr-3">
110 </div>
111 <span class="text-blue-700">Fetching plant information...</span>
112 </div>
113 </div>
163
164 try {
165 const response = await fetch(requestUrl);
166 const data = await response.json();
167
Plantfo

Plantfoadmin.html1 match

@Llad•Updated 15 hours ago
20 async function loadData() {
21 try {
22 const response = await fetch('/admin/cache/full');
23 const data = await response.json();
24
Plantfo

Plantfoindex.ts5 matches

@Llad•Updated 15 hours ago
88 }
89
90 console.log(`Fetching fresh data from OpenAI for: "${plantName}"`);
91 // If not cached, fetch from OpenAI
92 const prompt = `Please provide detailed information about the plant "${plantName}" in the following JSON format. Be specific and accurate:
93
165
166 } catch (error) {
167 console.error("Error fetching plant information:", error);
168 return c.json({
169 error: "Failed to fetch plant information",
170 details: error instanceof Error ? error.message : "Unknown error"
171 }, 500);
272});
273
274export default app.fetch; // This is the entry point for HTTP vals

untitled-8413index.ts7 matches

@chadparker•Updated 15 hours ago
20});
21
22// API endpoint to fetch user's vals
23app.get("/api/vals", async c => {
24 try {
32 }
33
34 // Fetch vals from Val Town API
35 const response = await fetch('https://api.val.town/v2/me/vals', {
36 headers: {
37 'Authorization': `Bearer ${apiToken}`,
70
71 } catch (error) {
72 console.error('Error fetching vals:', error);
73 return c.json<ApiResponse<null>>({
74 success: false,
91 }
92
93 const response = await fetch(`https://api.val.town/v1/vals/${valId}`, {
94 headers: {
95 'Authorization': `Bearer ${apiToken}`,
115
116 } catch (error) {
117 console.error('Error fetching val:', error);
118 return c.json<ApiResponse<null>>({
119 success: false,
123});
124
125export default app.fetch;

untitled-8413types.ts1 match

@chadparker•Updated 15 hours ago
5 name: string;
6 code?: string; // Not always included in list responses
7 type?: 'http' | 'cron' | 'email' | 'script'; // Need to fetch from individual val
8 privacy: 'public' | 'private' | 'unlisted';
9 author: {

mcp-servermain.ts26 matches

@joshbeckman•Updated 15 hours ago
2import { Hono, Context } from 'npm:hono';
3import { SSETransport } from 'npm:hono-mcp-server-sse-transport';
4import { toFetchResponse, toReqRes } from "npm:fetch-to-node";
5import { z } from "npm:zod";
6import lunr from "https://cdn.skypack.dev/lunr";
181 { limit: z.number().optional() },
182 async ({ limit }) => {
183 console.log(`${new Date().toISOString()} Fetching proverbs data`);
184 const proverbs = await fetch("https://www.joshbeckman.org/assets/js/proverbs.json").then((res) => res.json());
185 const results = proverbs
186 .sort(() => Math.random() - 0.5)
187 .slice(0, limit || 100);
188 console.log(`${new Date().toISOString()} Proverbs data fetched`);
189 const data = results.join("\n");
190 return {
198 { limit: z.number().optional(), tag: z.string() },
199 async ({ limit, tag }) => {
200 console.log(`${new Date().toISOString()} Fetching sequences data for tag: ${tag}`);
201 const sequences = await fetch("https://www.joshbeckman.org/assets/js/sequences.json").then((res) => res.json());
202 const results = sequences
203 .filter((seq: any) => seq.topic == tag)
204 .slice(0, limit || 100);
205 console.log(`${new Date().toISOString()} Sequences data fetched`);
206 if (results.length == 0) {
207 return {
222 { id: z.string() },
223 async ({ id }) => {
224 console.log(`${new Date().toISOString()} Fetching sequence data for ID: ${id}`);
225 const sequences = await fetch("https://www.joshbeckman.org/assets/js/sequences.json").then((res) => res.json());
226 const sequence = sequences.find((seq: any) => seq.id == id);
227 console.log(`${new Date().toISOString()} Sequence data fetched`);
228 if (!sequence) {
229 return {
242 { query: z.string(), limit: z.number().optional() },
243 async ({ query, limit }) => {
244 console.log(`${new Date().toISOString()} Fetching tags data for search`);
245 const tags = await fetch("https://www.joshbeckman.org/assets/js/tags.json").then((res) => res.json());
246 const tagsIndex = buildTagsIndex(tags);
247 console.log(`${new Date().toISOString()} Tags search index built`);
268 { tags: z.array(z.string()) },
269 async () => {
270 console.log(`${new Date().toISOString()} Fetching tags data`);
271 const sourceTags = await fetch("https://www.joshbeckman.org/assets/js/tags.json")
272 .then((res) => res.json());
273 console.log(`${new Date().toISOString()} Tags data fetched`);
274 const data = sourceTags.filter((tag) => tags.includes(tag.name)).map((tag) => {
275 return `[${tag.name}](${SITE_URL}${tag.url})`;
285 {},
286 async () => {
287 console.log(`${new Date().toISOString()} Fetching tags data`);
288 const tags = await fetch("https://www.joshbeckman.org/assets/js/tags.json")
289 .then((res) => res.json());
290 const data = tags.sort((a, b) => a.name.localeCompare(b.name)).map((tag) => {
291 return tag.name;
292 }).join("\n");
293 console.log(`${new Date().toISOString()} Tags data fetched`);
294 return {
295 content: [{ type: "text", text: data }]
299 server.tool(
300 "get_post",
301 "Get the full content and metadata of a specific post by its URL. This tool fetches the post data from the site and returns it in a structured format, including title, content, date, tags, author, and more.",
302 { url: z.string() },
303 async ({ url }) => {
304 console.log(`${new Date().toISOString()} Fetching post data for URL: ${url}`);
305 const searchData = await fetch("https://www.joshbeckman.org/assets/js/SearchData.json").then((res) => res.json());
306 const db: Array<Post> = Object.values(searchData).filter(postFilter).map((post) => {
307 post.author_id = post.author_id || "joshbeckman";
310 });
311 const post = db.find((post) => post.url == url || `${SITE_URL}${post.url}` == url);
312 console.log(`${new Date().toISOString()} Post data fetched`);
313 if (!post) {
314 return {
337 console.log(`${new Date().toISOString()} loading search data`);
338 const [searchData, indexCache] = await Promise.all([
339 fetch("https://www.joshbeckman.org/assets/js/SearchData.json").then((res) => res.json()),
340 fetch("https://www.joshbeckman.org/assets/js/lunr-index.json").then((res) => res.json()),
341 ]);
342 console.log(`${new Date().toISOString()} search data loaded`);
450 });
451
452 return toFetchResponse(res);
453 } catch (e) {
454 console.error(e);
501 * This will be exposed as a Val.town HTTP endpoint
502 */
503export default app.fetch;
504

FetchBasic2 file matches

@ther•Updated 6 days ago

GithubPRFetcher

@andybak•Updated 1 week ago