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=8&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 14090 results for "fetch"(1792ms)

fetch2 file matches

@vladimyr•Updated 1 year ago

fetch_example22 file matches

@vladimyr•Updated 1 year ago

fetch_example2 file matches

@vladimyr•Updated 1 year ago

fetch2 file matches

@std•Updated 1 year ago

fetchNewestVals1 file match

@vladimyr•Updated 1 year ago

fetchVal1 file match

@vladimyr•Updated 1 year ago

fetchText2 file matches

@vladimyr•Updated 1 year ago

fetchJSON2 file matches

@vladimyr•Updated 1 year ago

fetchJSON1 file match

@pomdtr•Updated 1 year ago

resilientFetch2 file matches

@easrng•Updated 1 year ago

honeydewmain.tsx3 matches

@legal•Updated 3 hours ago
682
683    try { 
684      const res = await fetch(\`\${API_URL}?action=chat\`, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ messages: conversationHistory.slice(0, -1), tasks, projects }) }); 
685      const data = await res.json(); 
686      if (!res.ok || data.error) throw new Error(data.error || 'Server error'); 
786    toggleLoading(btn, true); 
787    try { 
788      const res = await fetch(\`\${API_URL}?action=synthesizeProject\`, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ goal }) }); 
789      const data = await res.json(); 
790      if (!res.ok || data.error) throw new Error(data.error || "Server error"); 
804    toggleLoading(btn, true); 
805    try { 
806      const res = await fetch(\`\${API_URL}?action=dailyRebalance\`, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ tasks: todayTasks }) }); 
807      const data = await res.json(); 
808      if (!res.ok || data.error) throw new Error(data.error || "Server error"); 

mcp-servermain.ts26 matches

@joshbeckman•Updated 3 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 ({ tags }) => {
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 {
348 console.log(`${new Date().toISOString()} loading search data`);
349 const [searchData, indexCache] = await Promise.all([
350 fetch("https://www.joshbeckman.org/assets/js/SearchData.json").then((res) => res.json()),
351 fetch("https://www.joshbeckman.org/assets/js/lunr-index.json").then((res) => res.json()),
352 ]);
353 console.log(`${new Date().toISOString()} search data loaded`);
461 });
462
463 return toFetchResponse(res);
464 } catch (e) {
465 console.error(e);
512 * This will be exposed as a Val.town HTTP endpoint
513 */
514export default app.fetch;
515