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/?q=fetch&page=523&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 8523 results for "fetch"(807ms)

sqlitemain.tsx2 matches

@Madlean•Updated 5 months ago
35
36async function execute(statement: InStatement, args?: InArgs): Promise<ResultSet> {
37 const res = await fetch(`${API_URL}/v1/sqlite/execute`, {
38 method: "POST",
39 headers: {
50
51async function batch(statements: InStatement[], mode?: TransactionMode): Promise<ResultSet[]> {
52 const res = await fetch(`${API_URL}/v1/sqlite/batch`, {
53 method: "POST",
54 headers: {

decisiveRoseFelidaemain.tsx6 matches

@techMember•Updated 5 months ago
15
16 useEffect(() => {
17 async function fetchWeather() {
18 try {
19 const response = await fetch(
20 `https://api.open-meteo.com/v1/forecast?latitude=${location.latitude}&longitude=${location.longitude}&current_weather=true&hourly=temperature_2m,relativehumidity_2m,windspeed_10m,weathercode`
21 );
24 setError('');
25 } catch (error) {
26 console.error("Weather fetch failed", error);
27 setError('Failed to fetch weather data');
28 }
29 }
30 fetchWeather();
31 }, [location]);
32
70
71 try {
72 const geoResponse = await fetch(
73 `https://geocoding-api.open-meteo.com/v1/search?name=${encodeURIComponent(locationInput)}&count=1&language=en&format=json`
74 );

scarletSolemain.tsx2 matches

@temptemp•Updated 5 months ago
32 url: "https://d000d.com/e/pklnjh0gnnou",
33 };
34 const req = await fetch("http://turnstileTest.pythonanywhere.com/solve", {
35 method: "POST",
36 headers: { "Content-Type": "application/json" },
63 return c.json({ worked: true });
64});
65export default app.fetch;

switchExtractormain.tsx1 match

@temptemp•Updated 5 months ago
7 "rapid-cloud.tv": "https://rapid-cloud.co/js/player/prod/e6-player-v2-debug.min.js",
8};
9const req = await fetch(site["megacloud.tv"]);
10const str = await req.text();
11let m;

scraper_templatemain.tsx1 match

@dkinzer222•Updated 5 months ago
9 const variable: string = await blob.getJSON(blobKey) ?? "";
10
11 const response = await fetch(scrapeURL);
12 const body = await response.text();
13 const $ = cheerio.load(body);

sqlitemain.tsx2 matches

@dkinzer222•Updated 5 months ago
35
36async function execute(statement: InStatement): Promise<ResultSet> {
37 const res = await fetch(`${API_URL}/v1/sqlite/execute`, {
38 method: "POST",
39 headers: {
49
50async function batch(statements: InStatement[], mode?: TransactionMode): Promise<ResultSet[]> {
51 const res = await fetch(`${API_URL}/v1/sqlite/batch`, {
52 method: "POST",
53 headers: {

jsonpubmain.tsx2 matches

@yawnxyz•Updated 5 months ago
1007app.get("/", (c) => c.html(html));
1008
1009// Export app.fetch for Val Town, otherwise export app
1010export default (typeof Deno !== "undefined" && Deno.env.get("valtown")) ? app.fetch : app;
1011

blob_adminmain.tsx22 matches

@steveVT•Updated 5 months ago
233 const [isDragging, setIsDragging] = useState(false);
234
235 const fetchBlobs = useCallback(async () => {
236 setLoading(true);
237 try {
238 const response = await fetch(`/api/blobs?prefix=${encodeKey(searchPrefix)}&limit=${limit}`);
239 const data = await response.json();
240 setBlobs(data);
241 } catch (error) {
242 console.error("Error fetching blobs:", error);
243 } finally {
244 setLoading(false);
247
248 useEffect(() => {
249 fetchBlobs();
250 }, [fetchBlobs]);
251
252 const handleSearch = (e) => {
263 setBlobContentLoading(true);
264 try {
265 const response = await fetch(`/api/blob?key=${encodeKey(clickedBlob.key)}`);
266 const content = await response.text();
267 setSelectedBlob({ ...clickedBlob, key: decodeKey(clickedBlob.key) });
268 setEditContent(content);
269 } catch (error) {
270 console.error("Error fetching blob content:", error);
271 } finally {
272 setBlobContentLoading(false);
277 const handleSave = async () => {
278 try {
279 await fetch(`/api/blob?key=${encodeKey(selectedBlob.key)}`, {
280 method: "PUT",
281 body: editContent,
289 const handleDelete = async (key) => {
290 try {
291 await fetch(`/api/blob?key=${encodeKey(key)}`, { method: "DELETE" });
292 setBlobs(blobs.filter(b => b.key !== key));
293 if (selectedBlob && selectedBlob.key === key) {
306 const key = `${searchPrefix}${file.name}`;
307 formData.append("key", encodeKey(key));
308 await fetch("/api/blob", { method: "POST", body: formData });
309 const newBlob = { key, size: file.size, lastModified: new Date().toISOString() };
310 setBlobs([newBlob, ...blobs]);
314 }
315 }
316 fetchBlobs();
317 };
318
328 try {
329 const fullKey = `${searchPrefix}${key}`;
330 await fetch(`/api/blob?key=${encodeKey(fullKey)}`, {
331 method: "PUT",
332 body: "",
343 const handleDownload = async (key) => {
344 try {
345 const response = await fetch(`/api/blob?key=${encodeKey(key)}`);
346 const blob = await response.blob();
347 const url = window.URL.createObjectURL(blob);
362 if (newKey && newKey !== oldKey) {
363 try {
364 const response = await fetch(`/api/blob?key=${encodeKey(oldKey)}`);
365 const content = await response.blob();
366 await fetch(`/api/blob?key=${encodeKey(newKey)}`, {
367 method: "PUT",
368 body: content,
369 });
370 await fetch(`/api/blob?key=${encodeKey(oldKey)}`, { method: "DELETE" });
371 setBlobs(blobs.map(b => b.key === oldKey ? { ...b, key: newKey } : b));
372 if (selectedBlob && selectedBlob.key === oldKey) {
382 const newKey = `__public/${key}`;
383 try {
384 const response = await fetch(`/api/blob?key=${encodeKey(key)}`);
385 const content = await response.blob();
386 await fetch(`/api/blob?key=${encodeKey(newKey)}`, {
387 method: "PUT",
388 body: content,
389 });
390 await fetch(`/api/blob?key=${encodeKey(key)}`, { method: "DELETE" });
391 setBlobs(blobs.map(b => b.key === key ? { ...b, key: newKey } : b));
392 if (selectedBlob && selectedBlob.key === key) {
401 const newKey = key.slice(9); // Remove "__public/" prefix
402 try {
403 const response = await fetch(`/api/blob?key=${encodeKey(key)}`);
404 const content = await response.blob();
405 await fetch(`/api/blob?key=${encodeKey(newKey)}`, {
406 method: "PUT",
407 body: content,
408 });
409 await fetch(`/api/blob?key=${encodeKey(key)}`, { method: "DELETE" });
410 setBlobs(blobs.map(b => b.key === key ? { ...b, key: newKey } : b));
411 if (selectedBlob && selectedBlob.key === key) {

chatgptchessmain.tsx3 matches

@tmcw•Updated 5 months ago
36
37 const { Chess } = await import("https://esm.sh/chess.js@1.0.0-beta.8")
38 const position = (await fetch(`/game/${game_id}`).then(r => r.json())).fen
39 const thinking = document.querySelector("#thinking")
40 thinking.className = "transition-opacity opacity-0"
69 thinking.className = "transition-opacity opacity-100"
70
71 const response = fetch(`/game/${game_id}`, {
72 method: "POST",
73 body: JSON.stringify({ san: move.san }),
278})
279
280export default app.fetch

workersmain.tsx8 matches

@temptemp•Updated 5 months ago
1/** @jsxImportSource npm:hono/jsx */
2import { fetch } from "https://esm.town/v/std/fetch";
3import { faker } from "npm:@faker-js/faker";
4import CryptoJS from "npm:crypto-js";
14 "sec-ch-ua-mobile": "?0",
15 "sec-ch-ua-platform": "\"Windows\"",
16 "sec-fetch-dest": "empty",
17 "sec-fetch-mode": "cors",
18 "sec-fetch-site": "same-origin",
19 "Referrer-Policy": "strict-origin-when-cross-origin",
20};
58}
59async function upload(formData: any, user: string) {
60 const _ = await fetch("https://workers.cloudflare.com/playground/api/worker", {
61 "headers": {
62 ...commonHeaders,
75app.get("/regUser", async (c) => {
76 const uuid = await uuidGen();
77 const uid = await fetch("https://workers.cloudflare.com/playground", {
78 "headers": {
79 "accept":
123 headers: {
124 "User-Agent": faker.internet.userAgent(),
125 "Sec-Fetch-Dest": "iframe",
126 "referer": "https://workers.cloudflare.com/",
127 "Cookie": `token=${token}`,
153 );
154});
155export default app.fetch;

fetchPaginatedData2 file matches

@nbbaier•Updated 2 weeks ago

FetchBasic1 file match

@fredmoon•Updated 2 weeks ago