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=457&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 7868 results for "fetch"(821ms)

imggenpromain.tsx3 matches

@andiebuk•Updated 5 months ago
16 setImageData("");
17 try {
18 const response = await fetch("/generate", {
19 method: "POST",
20 headers: { "Content-Type": "application/json" },
167 console.log("Sending request to Together AI API:", togetherApiUrl);
168
169 const response = await fetch(togetherApiUrl, {
170 method: "POST",
171 headers: {
238 try {
239 const togetherApiUrl = "https://api.together.xyz/v1/images/generations";
240 const response = await fetch(togetherApiUrl, {
241 method: "POST",
242 headers: {

cronIntervalLoggermain.tsx4 matches

@dunnmary•Updated 5 months ago
1import { email } from "https://esm.town/v/std/email?v=9";
2
3// Fetches a random joke.
4async function fetchRandomJoke() {
5 const response = await fetch(
6 "https://official-joke-api.appspot.com/random_joke",
7 );
8 return response.json();
9}
10const randomJoke = await fetchRandomJoke();
11const setup = randomJoke.setup;
12const punchline = randomJoke.punchline;

cfetchmain.tsx2 matches

@temptemp•Updated 5 months ago
3const uuid = "1fd98a05-4959-42bc4-2f83-2c487c1cde6d";
4const build = `https://${uuid}.cloudflarepreviews.com/?url=`;
5export async function cfetch(input: string | URL, requestInit?: RequestInit) {
6 return fetch(`${build}${encodeURIComponent(input.toString())}`, {
7 ...requestInit,
8 headers: {

Storyweavermain.tsx1 match

@aioe0x417a•Updated 5 months ago
45 formData.append('previousStory', JSON.stringify(storyParts.parts));
46
47 const response = await fetch('/generate-story', {
48 method: 'POST',
49 body: formData

blob_adminmain.tsx23 matches

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

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);

fetchPaginatedData2 file matches

@nbbaier•Updated 1 week ago

FetchBasic1 file match

@fredmoon•Updated 1 week ago