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/$%7Burl%7D?q=fetch&page=1038&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 13430 results for "fetch"(2165ms)

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

diligentSapphireOrcamain.tsx4 matches

@gigmx•Updated 7 months ago
6 try {
7 const body = await req.json();
8 const apiResponse = await fetch("http://57.132.138.13:1865/message", {
9 method: "POST",
10 headers: {
37 if (url.pathname === "/api/health") {
38 try {
39 const apiResponse = await fetch("http://57.132.138.13:1865/");
40 return new Response(null, {
41 status: apiResponse.ok ? 200 : 500
247
248 // Test API connection through proxy
249 fetch("/api/health")
250 .then(response => {
251 if (!response.ok) throw new Error();
290
291 try {
292 const response = await fetch("/api/proxy", {
293 method: "POST",
294 headers: {

wittyTurquoiseDovemain.tsx7 matches

@all•Updated 7 months ago
205
206 useEffect(() => {
207 fetchSavedSnippets();
208 }, []);
209
210 async function fetchSavedSnippets() {
211 const response = await fetch("/snippets");
212 const snippets = await response.json();
213 setSavedSnippets(snippets);
216 async function handleSave() {
217 if (!code) return;
218 const response = await fetch("/snippets", {
219 method: "POST",
220 headers: { "Content-Type": "application/json" },
222 });
223 if (response.ok) {
224 fetchSavedSnippets();
225 }
226 }
227
228 async function handleDelete(id: number) {
229 const response = await fetch(`/snippets/${id}`, { method: "DELETE" });
230 if (response.ok) {
231 setSavedSnippets(snippets => snippets.filter(s => s.id !== id));
238
239 try {
240 const response = await fetch("/", {
241 method: "POST",
242 body: JSON.stringify({ prompt, currentCode: code }),

zwiftPortalScheduleREADME.md1 match

@dazzag24•Updated 7 months ago
1Fetch and parse the Zwift Climbing Portal Schedule XML from the Zwift CDN.
2
3Example usage:

GithubPRFetcher

@andybak•Updated 2 days ago

proxiedfetch1 file match

@jayden•Updated 3 days ago