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=509&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 8298 results for "fetch"(1917ms)

cekdatatruckmain.tsx13 matches

@nirwan•Updated 5 months ago
37 e.preventDefault();
38 try {
39 const response = await fetch("/api/vehicle", {
40 method: "POST",
41 headers: {
120
121 useEffect(() => {
122 fetchAllVehicles();
123 }, []);
124
125 const fetchAllVehicles = async () => {
126 const response = await fetch("/api/all-vehicles");
127 const data = await response.json();
128 setVehicles(data);
215 useEffect(() => {
216 if (selectedCompany) {
217 fetchVehicles(selectedCompany);
218 setShowVehicleList(true);
219 }
234 }, [showScanner]);
235
236 const fetchVehicles = async (company) => {
237 const response = await fetch(`/api/vehicles?company=${company}`);
238 const data = await response.json();
239 setVehicles(data);
240 };
241
242 const fetchAllVehicles = async () => {
243 const response = await fetch("/api/all-vehicles");
244 const data = await response.json();
245 return data;
265 const handleScanResult = async (decodedText) => {
266 try {
267 const allVehicles = await fetchAllVehicles();
268 const matchedVehicle = allVehicles.find(vehicle => vehicle.plateNumber === decodedText);
269
275 }
276 } catch (error) {
277 console.error("Error fetching vehicle data:", error);
278 setScanError("Error fetching vehicle data. Please try again.");
279 }
280 };
287 const handleVehicleAdded = () => {
288 setShowAddVehicleForm(false);
289 fetchVehicles(selectedCompany);
290 setShowVehicleList(true);
291 };

email_jokemain.tsx4 matches

@kswang06•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 );
9}
10
11const randomJoke = await fetchRandomJoke();
12const setup = randomJoke.setup;
13const punchline = randomJoke.punchline;

blob_adminmain.tsx2 matches

@danfishgold•Updated 5 months ago
1/** @jsxImportSource https://esm.sh/hono@4.0.8/jsx **/
2
3import { modifyFetchHandler } from "https://esm.town/v/andreterron/codeOnValTown?v=50";
4import view_route from "https://esm.town/v/pomdtr/blob_admin_blob";
5import create_route from "https://esm.town/v/pomdtr/blob_admin_create";
137});
138
139export default modifyFetchHandler(passwordAuth(app.fetch));

blobmain.tsx4 matches

@bons•Updated 5 months ago
82async function list(prefix?: string): Promise<{ key: string; size: number; lastModified: string }[]> {
83 let querystring = prefix ? `?prefix=${encodeURIComponent(prefix)}` : "";
84 const res = await fetch(`${API_URL}/v1/blob${querystring}`, {
85 headers: {
86 Authorization: `Bearer ${Deno.env.get("valtown")}`,
95
96async function delete_(key: string) {
97 const res = await fetch(`${API_URL}/v1/blob/${encodeURIComponent(key)}`, {
98 method: "DELETE",
99 headers: {
108
109async function get(key: string) {
110 const res = await fetch(`${API_URL}/v1/blob/${encodeURIComponent(key)}`, {
111 headers: {
112 Authorization: `Bearer ${Deno.env.get("valtown")}`,
124
125async function set(key: string, value: BodyInit) {
126 const res = await fetch(`${API_URL}/v1/blob/${encodeURIComponent(key)}`, {
127 method: "POST",
128 headers: {

sqliteExplorerAppmain.tsx4 matches

@lecoto•Updated 5 months ago
1/** @jsxImportSource https://esm.sh/hono@latest/jsx **/
2
3import { modifyFetchHandler } from "https://esm.town/v/andreterron/codeOnValTown?v=50";
4import { iframeHandler } from "https://esm.town/v/nbbaier/iframeHandler";
5import { resetStyle } from "https://esm.town/v/nbbaier/resetStyle";
15import { verifyToken } from "https://esm.town/v/pomdtr/verifyToken";
16import { ResultSet, sqlite } from "https://esm.town/v/std/sqlite";
17import { reloadOnSaveFetchMiddleware } from "https://esm.town/v/stevekrouse/reloadOnSave";
18import { Hono } from "npm:hono";
19import type { FC } from "npm:hono/jsx";
302});
303
304export const handler = app.fetch;
305export default iframeHandler(modifyFetchHandler(passwordAuth(handler, { verifyPassword: verifyToken })));

blob_adminmain.tsx2 matches

@lecoto•Updated 5 months ago
1/** @jsxImportSource https://esm.sh/hono@4.0.8/jsx **/
2
3import { modifyFetchHandler } from "https://esm.town/v/andreterron/codeOnValTown?v=50";
4import view_route from "https://esm.town/v/pomdtr/blob_admin_blob";
5import create_route from "https://esm.town/v/pomdtr/blob_admin_create";
143});
144
145export default modifyFetchHandler(passwordAuth(app.fetch, {
146 async getPassword() {
147 return await getOrSetPassword();

blob_adminmain.tsx2 matches

@bons•Updated 5 months ago
1/** @jsxImportSource https://esm.sh/hono@4.0.8/jsx **/
2
3import { modifyFetchHandler } from "https://esm.town/v/andreterron/codeOnValTown?v=50";
4import view_route from "https://esm.town/v/pomdtr/blob_admin_blob";
5import create_route from "https://esm.town/v/pomdtr/blob_admin_create";
137});
138
139export default modifyFetchHandler(passwordAuth(app.fetch));

tidyRedWhalemain.tsx1 match

@websrai•Updated 5 months ago
20
21 try {
22 const response = await fetch('/chat', {
23 method: 'POST',
24 headers: { 'Content-Type': 'application/json' },

modernSalesCRMmain.tsx9 matches

@shrirudragoud•Updated 5 months ago
76
77 useEffect(() => {
78 fetchLeads();
79 }, []);
80
81 const fetchLeads = async () => {
82 try {
83 const controller = new AbortController();
84 const timeoutId = setTimeout(() => controller.abort(), 5000);
85
86 const response = await fetch('/api/leads', {
87 signal: controller.signal
88 });
91
92 if (!response.ok) {
93 throw new Error('Failed to fetch leads');
94 }
95
97 setLeads(data);
98 } catch (error) {
99 console.error("Failed to fetch leads", error);
100 setError(error.message);
101 }
107 const timeoutId = setTimeout(() => controller.abort(), 5000);
108
109 const response = await fetch('/api/leads', {
110 method: 'POST',
111 headers: { 'Content-Type': 'application/json' },
120 }
121
122 await fetchLeads();
123 setNewLead({ name: '', email: '', phone: '', status: 'New' });
124 } catch (error) {
245 });
246 } catch (error) {
247 console.error('Fetch leads error:', error);
248 return new Response(JSON.stringify({ error: 'Failed to fetch leads' }), {
249 status: 500,
250 headers: { 'Content-Type': 'application/json' }

cerebras_codermain.tsx1 match

@zananowshad•Updated 5 months ago
23
24 try {
25 const response = await fetch("/", {
26 method: "POST",
27 body: JSON.stringify({ prompt, currentCode: code }),

fetchPaginatedData2 file matches

@nbbaier•Updated 2 weeks ago

FetchBasic1 file match

@fredmoon•Updated 2 weeks ago