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/image-url.jpg%20%22Image%20title%22?q=fetch&page=683&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 9416 results for "fetch"(1850ms)

dailyDadJokemain.tsx2 matches

@davidpadbury•Updated 8 months ago
1import { email } from "https://esm.town/v/std/email";
2import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON";
3
4export async function dailyDadJoke() {
5 let { setup, punchline } = await fetchJSON("https://official-joke-api.appspot.com/random_joke");
6 return email({
7 text: punchline,

readableHtmlmain.tsx2 matches

@neverstew•Updated 8 months ago
1import { fetchText } from "https://esm.town/v/stevekrouse/fetchText";
2import { Readability } from "npm:@mozilla/readability";
3
16
17async function readableHtmlFromUrl(url: URL, options?: RequestInit): Promise<string> {
18 const body = await fetchText(url.toString(), options);
19 return readableHtmlFromText(body);
20}

githubRepoViewermain.tsx5 matches

@ejfox•Updated 8 months ago
11
12 const apiUrl = `https://api.github.com/repos/${user}/${repo}/contents`;
13 const response = await fetch(apiUrl);
14 const contents = await response.json();
15
18 fileList = contents.map(file => `<li>${file.name} (${file.type})</li>`).join("");
19 } else {
20 fileList = "<li>Error: Unable to fetch repository contents</li>";
21 }
22
46 <input type="text" id="user" placeholder="GitHub Username">
47 <input type="text" id="repo" placeholder="Repository Name">
48 <button onclick="fetchFiles()">Fetch Files</button>
49 <div id="result"></div>
50
51 <script>
52 async function fetchFiles() {
53 const user = document.getElementById('user').value;
54 const repo = document.getElementById('repo').value;
56 result.innerHTML = 'Loading...';
57
58 const response = await fetch(\`/api/files?user=\${user}&repo=\${repo}\`);
59 const html = await response.text();
60 result.innerHTML = html;

BlogChatbotServermain.tsx2 matches

@weaverwhale•Updated 8 months ago
73 userInput.value = '';
74
75 const response = await fetch('/chat', {
76 method: 'POST',
77 headers: { 'Content-Type': 'application/json' },
137
138export default async function server(req: Request): Promise<Response> {
139 return app.fetch(req);
140}

requiredOrangeRattlesnakemain.tsx1 match

@tfayyaz•Updated 8 months ago
72
73export default {
74 fetch: app.fetch,
75 port: 3000,
76};

FindTrendsUsingGPTmain.tsx1 match

@weaverwhale•Updated 8 months ago
134});
135
136export default app.fetch;

isMyWebsiteDownmain.tsx2 matches

@pj0•Updated 8 months ago
14 start = performance.now();
15 try {
16 const res = await fetch(url);
17 end = performance.now();
18 status = res.status;
25 } catch (e) {
26 end = performance.now();
27 reason = `couldn't fetch: ${e}`;
28 ok = false;
29 console.log(`Website down (${url}): ${reason} (${end - start}ms)`);

CIDGenerationmain.tsx1 match

@stevedylandev•Updated 8 months ago
58 });
59
60 const res = await fetch("https://api.pinata.cloud/pinning/pinJSONToIPFS", {
61 method: "POST",
62 headers: {

esmmain.tsx1 match

@pomdtr•Updated 8 months ago
24 }
25 }
26 const resp = await fetch(`https://api.val.town/v1/alias/${author}/${name}`, {
27 headers,
28 });

csvViewermain.tsx1 match

@g•Updated 8 months ago
173app.get('/main.js', serve(js, 'text/javascript'));
174
175export default app.fetch;

proxyFetch2 file matches

@vidar•Updated 2 days ago

TAC_FetchBasic2 file matches

@A7_OMC•Updated 2 days ago