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=604&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 7615 results for "fetch"(727ms)

valtownByExamplemain.tsx1 match

@pomdtr•Updated 1 year ago
112});
113
114export default app.fetch;

insecureFetchREADME.md5 matches

@stevekrouse•Updated 1 year ago
1# Insecure SSL Cert Fetch
2
3This will be useful if you're getting a `invalid peer certificate: UnknownIssuer error`.
4
5If you need to make a fetch request to a website with a dubious or non-standard SSL certificate, you can use this proxy we made on Cloudflare workers (which doesn't verify SSL certs): https://unsecure-fetch.val-town.workers.dev/
6
7```ts
8import { insecureFetch } from "https://esm.town/v/stevekrouse/insecureFetch";
9
10const url = "https://assignment-api.uspto.gov/patent/basicSearch?query=1234567&fields=main&rows=20";
11const data = await insecureFetch(url)
12const text = await data.text();
13console.log(text)
14```
15
16Migrated from folder: Archive/insecureFetch

openaiUploadFilemain.tsx2 matches

@stevekrouse•Updated 1 year ago
1import { fetch } from "https://esm.town/v/std/fetch";
2
3export async function openaiUploadFile({ key, data, purpose = "assistants" }: {
16 formData.append("purpose", purpose);
17 formData.append("file", file, "data.json");
18 let result = await fetch("https://api.openai.com/v1/files", {
19 method: "POST",
20 headers: {

BlueCardChangeDetectormain.tsx1 match

@wilhelm•Updated 1 year ago
7
8export default async function(interval: Interval) {
9 const page = await fetch(site).then(res => res.text());
10 const date = page.match(/Last updated: <time datetime="([^"]+)">/)?.[1].toString();
11 const lastChange = await blob.get(dateChangedKey).then(res => res?.text()).catch(() => "");

isMyWebsiteDownmain.tsx2 matches

@didier•Updated 1 year ago
9 let reason: string;
10 try {
11 const res = await fetch(URL, { redirect: "follow" });
12 if (res.status !== 200) {
13 reason = `(status code: ${res.status})`;
15 }
16 } catch (e) {
17 reason = `couldn't fetch: ${e}`;
18 ok = false;
19 }

apimain.tsx2 matches

@pomdtr•Updated 1 year ago
15
16 while (true) {
17 const resp = await fetch(url);
18 if (!resp.ok) {
19 throw new Error(await resp.text());
32 return { data } as T;
33 }
34 const resp = await fetch(`${API_URL}${path}`, {
35 ...options,
36 headers: {

apimain.tsx2 matches

@zeroftdev•Updated 1 year ago
15
16 while (true) {
17 const resp = await fetch(url);
18 if (!resp.ok) {
19 throw new Error(await resp.text());
32 return { data } as T;
33 }
34 const resp = await fetch(`https://api.val.town${path}`, {
35 ...options,
36 headers: {

CS1200SystemsDevmain.tsx4 matches

@stephencooley123•Updated 1 year 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;

aquamarineFlamingomain.tsx4 matches

@tual•Updated 1 year 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;

cyanVolemain.tsx4 matches

@rohannagpure45•Updated 1 year ago
1import { email } from "https://esm.town/v/std/email?v=9";
2// Fetches a random joke.
3async function fetchRandomJoke() {
4 const response = await fetch(
5 "https://official-joke-api.appspot.com/random_joke",
6 );
8}
9
10const randomJoke = await fetchRandomJoke();
11const setup = randomJoke.setup;
12const punchline = randomJoke.punchline;

fetchPaginatedData2 file matches

@nbbaier•Updated 1 week ago

FetchBasic1 file match

@fredmoon•Updated 1 week ago