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/$%7Bsuccess?q=fetch&page=623&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 9288 results for "fetch"(2048ms)

fullWebsiteVersionmain.tsx4 matches

@willthereader•Updated 6 months ago
11 console.log(`Checking URL: ${url}`);
12 try {
13 const response = await fetch(url, { method: "HEAD" });
14
15 if (!response.ok) {
16 console.log(`Attempting GET request as fallback for: ${url}`);
17 const getResponse = await fetch(url, { method: "GET" });
18 return { ok: getResponse.ok, status: getResponse.status };
19 }
72 `;
73
74 const lsdResponse = await fetch(
75 `https://lsd.so/api?query=${encodeURIComponent(query)}`,
76 );
80
81 if (!lsdResponse.ok) {
82 console.error(`Failed to fetch links from ${currentUrl}`);
83 continue;
84 }

BBslackScoutmain.tsx8 matches

@alexdphan•Updated 6 months ago
20 for (const topic of KEYWORDS) {
21 const results = await Promise.allSettled([
22 fetchHackerNewsResults(topic),
23 fetchTwitterResults(topic),
24 fetchRedditResults(topic),
25 ]);
26
49}
50
51// Fetch Hacker news, Twitter, and Reddit results
52async function fetchHackerNewsResults(topic: string): Promise<Website[]> {
53 return hackerNewsSearch({
54 query: topic,
58}
59
60async function fetchTwitterResults(topic: string): Promise<Website[]> {
61 return twitterSearch({
62 query: topic,
67}
68
69async function fetchRedditResults(topic: string): Promise<Website[]> {
70 return redditSearch({ query: topic });
71}
84 }
85
86 const response = await fetch(slackWebhookUrl, {
87 method: "POST",
88 headers: { "Content-Type": "application/json" },

falProxyRequestmain.tsx1 match

@stevekrouse•Updated 6 months ago
4 const headers = new Headers(req.headers);
5 headers.set("x-proxy-authorization", `Bearer ${Deno.env.get("valtown")}`);
6 return fetch("https://fal-faltownproxy.web.val.run/api/faltown/proxy", {
7 method,
8 headers,

cerebras_codermain.tsx1 match

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

reqEvaltownmain.tsx1 match

@maxm•Updated 6 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 6 months ago
172});
173
174export default app.fetch.bind(app);
175
176const css = `

discordActivityClientmain.tsx6 matches

@neverstew•Updated 6 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 6 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 6 months ago
64
65 try {
66 const response = await fetch('${httpEndpoint}', {
67 method: 'POST',
68 body: code,

fearlessVioletAnteatermain.tsx5 matches

@vawogbemi•Updated 6 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">

proxyFetch2 file matches

@vidar•Updated 1 day ago

TAC_FetchBasic2 file matches

@A7_OMC•Updated 2 days ago