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/$1?q=fetch&page=1029&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"(1362ms)

reqEvaltownmain.tsx1 match

@maxm•Updated 7 months ago
32 const url = new URL("." + pathname, "http://localhost:" + port);
33 url.search = search;
34 const resp = await fetch(url, {
35 method: req.method,
36 headers: req.headers,

valtowntownmain.tsx1 match

@maxm•Updated 7 months ago
172});
173
174export default app.fetch.bind(app);
175
176const css = `

discordActivityClientmain.tsx6 matches

@neverstew•Updated 7 months ago
51 // /.proxy/ is prepended here in compliance with CSP
52 // see https://discord.com/developers/docs/activities/development-guides#construct-a-full-url
53 const response = await fetch("/.proxy/api/token", {
54 method: "POST",
55 headers: {
73
74/**
75 * This function fetches the current voice channel over RPC. It then creates a
76 * text element that displays the voice channel's name
77 */
106 * This function utilizes RPC and HTTP apis, in order show the current guild's avatar
107 * Here are the steps:
108 * 1. From RPC fetch the currently selected voice channel, which contains the voice channel's guild id
109 * 2. From the HTTP API fetch a list of all of the user's guilds
110 * 3. Find the current guild's info, including its "icon"
111 * 4. Append to the UI an img tag with the related information
117 }
118
119 // 1. From the HTTP API fetch a list of all of the user's guilds
120 const guilds = await fetch(
121 "https://discord.com/api/users/@me/guilds",
122 {

blobbyFacemain.tsx18 matches

@yawnxyz•Updated 7 months ago
2import { blobby } from "https://esm.town/v/yawnxyz/blobby";
3import { fileTypeFromBuffer } from 'npm:file-type';
4import { modifyFetchHandler } from "https://esm.town/v/andreterron/codeOnValTown?v=50";
5import { cors } from "npm:hono/cors";
6
75
76
77// Endpoint to fetch blob by key
78app.get("/blob/:key", async (c) => {
79 const key = c.req.param('key');
219 this.blobs[key] = {isLoading: true};
220
221 const response = await fetch('/blob/' + key);
222 const contentType = response.headers.get('Content-Type');
223 blob.type = contentType || 'text/plain';
249 let blob = this.blobs[key];
250 try {
251 const response = await fetch('/create/' + key, {
252 method: 'POST',
253 headers: {
273
274 // Send a delete request to the server
275 const response = await fetch('/delete/' + key, { method: 'GET' });
276
277 // Check the response status
343
344 try {
345 const response = await fetch('/upload/' + key, {
346 method: 'POST',
347 body: formData,
368
369 try {
370 const response = await fetch('/uploadUrl' + '?key=' + key + '&url=' + url);
371
372 if (!response.ok) {
391 if (!this.newKeyName) return;
392 try {
393 const response = await fetch('/rename?key='+key+'&newKey='+this.newKeyName);
394 if (!response.ok) {
395 throw new Error('Failed to rename blob');
559 async loadBlob() {
560 this.isLoading = true;
561 const response = await fetch('/blob/' + this.key);
562 const contentType = response.headers.get('Content-Type');
563 this.blobType = contentType || 'text/plain';
583 async updateCreate() {
584 try {
585 const response = await fetch('/create/' + this.key, {
586 method: 'POST',
587 headers: {
606
607 try {
608 const response = await fetch('/upload/' + this.key, {
609 method: 'POST',
610 body: formData,
626 if (this.uploadUrl) {
627 try {
628 const response = await fetch('/uploadUrl?key=' + this.key + '&url=' + this.uploadUrl);
629
630 if (!response.ok) {
643 if (!this.newKeyName) return;
644 try {
645 const response = await fetch('/rename?key=' + this.key + '&newKey=' + this.newKeyName);
646 if (!response.ok) {
647 throw new Error('Failed to rename blob');
661 }
662 try {
663 const response = await fetch('/delete/' + this.key, { method: 'GET' });
664 if (!response.ok) {
665 throw new Error('Failed to delete blob');
763
764
765export default app.fetch;
766
767// import { verifyToken } from "https://esm.town/v/pomdtr/verifyToken";
770
771
772// export default passwordAuth(app.fetch);
773
774// export default passwordAuth(app.fetch, { verifyPassword: verifyToken });
775// export default passwordAuth(app.fetch, { verifyPassword: (password) => password == "yespleasetakealook" });
776// }, { verifyPassword: (password) => password == Deno.env.get("VAL_PASSWORD") });
777

evalUImain.tsx1 match

@maxm•Updated 7 months ago
64
65 try {
66 const response = await fetch('${httpEndpoint}', {
67 method: 'POST',
68 body: code,

fearlessVioletAnteatermain.tsx5 matches

@vawogbemi•Updated 7 months ago
42 e.preventDefault();
43 const finalAmount = showCustomAmount ? parseFloat(customAmount) : amount;
44 const response = await fetch("/create-checkout-session", {
45 method: "POST",
46 headers: { "Content-Type": "application/json" },
205
206 useEffect(() => {
207 fetchPayments();
208 const urlParams = new URLSearchParams(window.location.search);
209 if (urlParams.get('success') === 'true') {
212 }, []);
213
214 const fetchPayments = async () => {
215 const response = await fetch('/get-payments');
216 const data = await response.json();
217 setPayments(data);
223 <div className="w-full max-w-[90%] flex flex-col md:flex-row gap-8">
224 <div className="w-full md:w-1/2 order-2 md:order-1">
225 <TippingForm onPaymentSuccess={fetchPayments} />
226 </div>
227 <div className="w-full md:w-1/2 order-1 md:order-2">

prodigiousTanTurtlemain.tsx18 matches

@ocholap9•Updated 7 months ago
111 const handleSubmit = async (e) => {
112 e.preventDefault();
113 const response = await fetch('/api/login', {
114 method: 'POST',
115 headers: { 'Content-Type': 'application/json' },
146 const handleSubmit = async (e) => {
147 e.preventDefault();
148 const response = await fetch('/api/register', {
149 method: 'POST',
150 headers: { 'Content-Type': 'application/json' },
181 const handleSubmit = async (e) => {
182 e.preventDefault();
183 const response = await fetch('/api/profile', {
184 method: 'PUT',
185 headers: {
225
226 useEffect(() => {
227 fetchVehicles();
228 fetchTransactions();
229 }, []);
230
231 const fetchVehicles = async () => {
232 const response = await fetch('/api/vehicles', {
233 headers: { 'Authorization': `Bearer ${localStorage.getItem('token')}` },
234 });
239 };
240
241 const fetchTransactions = async () => {
242 const response = await fetch('/api/transactions', {
243 headers: { 'Authorization': `Bearer ${localStorage.getItem('token')}` },
244 });
275
276 useEffect(() => {
277 fetchTollBooths();
278 }, []);
279
280 const fetchTollBooths = async () => {
281 const response = await fetch('/api/toll-booths', {
282 headers: { 'Authorization': `Bearer ${localStorage.getItem('token')}` },
283 });
312
313 useEffect(() => {
314 fetchRevenueReport();
315 fetchTrafficAnalytics();
316 }, []);
317
318 const fetchRevenueReport = async () => {
319 const response = await fetch('/api/revenue-report', {
320 headers: { 'Authorization': `Bearer ${localStorage.getItem('token')}` },
321 });
326 };
327
328 const fetchTrafficAnalytics = async () => {
329 const response = await fetch('/api/traffic-analytics', {
330 headers: { 'Authorization': `Bearer ${localStorage.getItem('token')}` },
331 });

fastCoffeeLizardmain.tsx5 matches

@mvmattgray•Updated 7 months ago
126
127 <script>
128 async function fetchData() {
129 try {
130 const response = await fetch(window.location.href, { headers: { 'accept': 'application/json' } });
131 const data = await response.json();
132
136 thermometerFill.style.width = percentage + "%";
137 } catch (error) {
138 console.error('Error fetching data:', error);
139 }
140 }
141
142 fetchData(); // Fetch data on page load
143 </script>
144 </body>
161 });
162 } catch (error) {
163 console.error("Error fetching data:", error);
164 return new Response(`Error: ${error.message}`, { status: 500 });
165 }

sqliteExplorerAppmain.tsx4 matches

@robaggio•Updated 7 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";
16import { sqliteStyle } from "https://esm.town/v/robaggio/sqliteStyle";
17import { ResultSet, sqlite } from "https://esm.town/v/std/sqlite";
18import { reloadOnSaveFetchMiddleware } from "https://esm.town/v/stevekrouse/reloadOnSave";
19import { Hono } from "npm:hono";
20import type { FC } from "npm:hono/jsx";
175});
176
177export const handler = app.fetch;
178export default iframeHandler(modifyFetchHandler(passwordAuth(handler, { verifyPassword: verifyToken })));

whoIsHiringmain.tsx12 matches

@lowlu•Updated 7 months ago
61 }, [state.loading, state.hasMore]);
62
63 const fetchStories = async () => {
64 try {
65 const response = await fetch("/api/stories");
66 if (!response.ok) throw new Error("Failed to fetch dates");
67 const data = await response.json();
68 setStories(data);
70 }
71 catch (err) {
72 console.error("Error fetching stories:", err);
73 }
74 };
75
76 const fetchComments = async (query: string, story: string, page: number) => {
77 try {
78 dispatch({ type: "loading", value: true });
79 const response = await fetch(`/api/comments?query=${encodeURIComponent(query)}&story=${story}&page=${page}`);
80 if (!response.ok) throw new Error("Failed to fetch comments");
81 const data = await response.json();
82 setComments(prevComments => page === 1 ? data.hits : [...prevComments, ...data.hits]);
84 dispatch({ type: "loading", value: false });
85 } catch (err) {
86 console.error("Error fetching comments:", err);
87 dispatch({ type: "loading", value: false });
88 }
99 dispatch({ type: "hasMore", value: true });
100 dispatch({ type: "query", value: newQuery });
101 fetchComments(fullQuery, state.story, 1);
102 };
103
104 useEffect(() => {
105 fetchStories();
106
107 const handleScroll = () => {
122 : "";
123 const fullQuery = `${filtersQuery} ${state.query}`;
124 fetchComments(fullQuery, state.story, state.page);
125 }
126 }
418 tags: `comment, story_${story}`,
419 page: 0,
420 hitsPerPage: 100, // Fetch a moderate number of comments
421 });
422

GithubPRFetcher

@andybak•Updated 1 day ago

proxiedfetch1 file match

@jayden•Updated 2 days ago