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/$2?q=fetch&page=25&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 13344 results for "fetch"(679ms)

bluetoothscannerindex.ts1 match

@dcm31•Updated 2 days ago
20});
21
22export default app.fetch;

HTTP_exampleshonoExample1 match

@eddloschi•Updated 2 days ago
4app.get("/", (c) => c.text("Hello from Hono!"));
5app.get("/yeah", (c) => c.text("Routing!"));
6export default app.fetch;

HTTP_examplesfetsExample1 match

@eddloschi•Updated 2 days ago
21});
22
23export default router.fetch;

socialDataSearchmain.tsx2 matches

@stevekrouse•Updated 2 days ago
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON";
2
3export async function socialDataSearch(query: string): Promise<SocialDataResponse> {
4 const url = new URL("https://stevekrouse-socialdataproxy.web.val.run/twitter/search");
5 url.searchParams.set("query", query);
6 return await fetchJSON(url.toString(), {
7 bearer: Deno.env.get("valtown"),
8 });

MiniAppStarterApp.tsx5 matches

@moe•Updated 2 days ago
9import { Button, Section } from "./components/ui.tsx";
10import { CustomHaptics } from "./screens/CustomHaptics.tsx";
11import { fetchNeynarGet } from "./util/neynar.ts";
12
13export function App() {
70
71function Database() {
72 const queryFn = () => fetch("/api/counter/get").then((r) => r.json());
73 const { data, refetch } = useQuery({ queryKey: ["counter"], queryFn });
74 return (
75 <Section className="flex flex-col items-start gap-3 m-5">
76 {/* <h2 className="font-semibold">Database Example</h2> */}
77 <div className="">Counter value: {data}</div>
78 <Button variant="outline" onClick={() => fetch("/api/counter/increment").then(refetch)}>
79 Increment
80 </Button>
85function Neynar() {
86 useEffect(() => {
87 fetchNeynarGet("user/by_username?username=moe").then(console.log).catch(console.error);
88 }, []);
89

realtymain.tsx2 matches

@legal•Updated 2 days ago
667 // This now directly calls the main analysis endpoint (which uses the new prompt)
668 try {
669 const response = await fetch(window.location.pathname + '?format=json&action=loanAssumptionInfo', { method: 'POST', body: formData });
670 const responseData = await response.json();
671
954export default async function(req: Request) {
955 const { OpenAI } = await import("https://esm.town/v/std/openai");
956 const { fetch } = await import("https://esm.town/v/std/fetch");
957 // PDFExtract is kept if you want to add document features later, but not primary for this use case.
958 const { PDFExtract, PDFExtractOptions } = await import("npm:pdf.js-extract");

docsmain.tsx9 matches

@legal•Updated 2 days ago
590 formData.append('inputSourceDescription', clientInputSourceDescription);
591 try {
592 const response = await fetch(window.location.pathname + '?action=suggestTasks&format=json', { method: 'POST', body: formData });
593 const responseData = await response.json();
594 (responseData.log || []).forEach(logEntry => {
636 formData.append('inputSourceDescription', ni_currentInputSourceDescription);
637 try {
638 const response = await fetch(window.location.pathname + '?format=json', { method: 'POST', body: formData });
639 const responseData = await response.json();
640 (responseData.log || []).forEach(logEntry => {
881export default async function(req: Request) {
882 const { OpenAI } = await import("https://esm.town/v/std/openai");
883 const { fetch } = await import("https://esm.town/v/std/fetch");
884 const { PDFExtract, PDFExtractOptions } = await import("npm:pdf.js-extract");
885 const CORS_HEADERS = {
1001 derivedInputSourceDescription = "Pasted Text";
1002 } else if (input.documentUrl) {
1003 log.push({ agent: ingestionAgent, type: "step", message: `Fetching from URL: ${input.documentUrl}` });
1004 derivedInputSourceDescription = `URL: ${input.documentUrl}`;
1005 try {
1006 const response = await fetch(input.documentUrl, {
1007 headers: { "Accept": "text/plain, text/html, application/pdf" },
1008 });
1010 const contentType = response.headers.get("content-type") || "";
1011 if (contentType.includes("application/pdf")) {
1012 log.push({ agent: ingestionAgent, type: "info", message: "Fetched PDF from URL. Extracting text..." });
1013 const pdfBuffer = await response.arrayBuffer();
1014 documentText = await extractPdfTextNative(
1019 } else {
1020 const text = await response.text();
1021 if (!text || text.trim().length === 0) throw new Error("Fetched content is empty or not text.");
1022 log.push({ agent: ingestionAgent, type: "info", message: `Fetched ~${text.length} characters from URL.` });
1023 documentText = text;
1024 }
1027 agent: ingestionAgent,
1028 type: "error",
1029 message: `Failed to fetch/process URL ${input.documentUrl}: ${error.message}`,
1030 });
1031 }

randoDiscmain.tsx22 matches

@gwoods22•Updated 2 days ago
141 const [hasInteracted, setHasInteracted] = useState(false);
142 const [useFallbackData, setUseFallbackData] = useState(false);
143 const fetchedRecords = useRef(new Set());
144
145 const loadFallbackData = useCallback(() => {
207 }, []);
208
209 const fetchReleases = useCallback(async () => {
210 setIsLoading(true);
211 setError(null);
212 try {
213 const response = await fetch(
214 "https://ashryanio-getallreleasesfromdiscogs.web.val.run"
215 );
217 throw new Error(`HTTP error! status: ${response.status}`);
218 }
219 const fetchedRecords = await response.json();
220 if (!Array.isArray(fetchedRecords)) {
221 throw new Error("Received data is not an array");
222 }
223
224 const shuffledRecords = shuffleArray(fetchedRecords);
225 setRecords(shuffledRecords);
226 setIsLoading(false);
227 setUseFallbackData(false);
228 } catch (error) {
229 console.error("Failed to fetch releases:", error);
230 setError(
231 `Failed to load records: ${error.message}. The API endpoint might be down.`
236
237 useEffect(() => {
238 fetchReleases();
239 }, [fetchReleases]);
240
241 // Fetch release year for the current record
242 useEffect(() => {
243 async function fetchReleaseYear() {
244 if (records.length === 0) return;
245
247 if (
248 !currentRecord ||
249 fetchedRecords.current.has(currentRecord.basic_information.master_id)
250 ) {
251 return; // Skip if already fetched
252 }
253
254 try {
255 console.log("Fetching release year for:", currentRecord);
256 const response = await fetch(
257 `https://ashryanio-getallreleasesfromdiscogs.web.val.run/masters?id=${currentRecord.basic_information.master_id}`
258 );
259 if (!response.ok) {
260 throw new Error(`Failed to fetch release year: ${response.status}`);
261 }
262 const data = await response.json();
263 console.log("Fetched data:", data);
264
265 // Mark as fetched
266 fetchedRecords.current.add(currentRecord.basic_information.master_id);
267
268 // Update the record
275 );
276 } catch (error) {
277 console.error("Error fetching release year:", error);
278 }
279 }
280
281 fetchReleaseYear();
282 }, [currentRecordIndex, records.length]);
283
357 <ErrorMessage
358 message={error}
359 retry={fetchReleases}
360 useFallback={loadFallbackData}
361 />

templateTwitterAlertmain.tsx1 match

@kirupa•Updated 2 days ago
19 : Math.floor((Date.now() - 2 * 24 * 60 * 60 * 1000) / 1000);
20
21 // Fetch and log tweets
22 const response = await socialDataSearch(`${query} since_time:${timeFrame}`);
23 console.log("Response from socialDataSearch:", response);

MiniAppStarterHome.tsx1 match

@moe•Updated 2 days ago
7
8import { Button, Input, Section } from "../components/ui.tsx";
9import { fetchUsersById } from "../util/neynar.ts";
10
11export function Home() {

GithubPRFetcher

@andybak•Updated 1 day ago

proxiedfetch1 file match

@jayden•Updated 2 days ago