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=1200&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 13568 results for "fetch"(5178ms)

fetch_example2README.md1 match

@vladimyr•Updated 1 year ago
1Migrated from folder: a2_shared/fetch_example2

CS1200main.tsx4 matches

@parkddongddoong•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;

activityPubAgentmain.tsx3 matches

@vladimyr•Updated 1 year ago
2import { extractValInfo } from "https://esm.town/v/pomdtr/extractValInfo";
3import { createInstanceActor } from "https://esm.town/v/vladimyr/activityPubInstanceActor";
4import { createSignedFetch } from "https://esm.town/v/vladimyr/signedFetch";
5import { privateKeyPem, publicKeyPem } from "https://esm.town/v/vladimyr/signRequest_testdata";
6
12export { id, publicKeyId };
13
14const signedFetch = createSignedFetch({
15 pkcs8: privateKeyPem,
16 publicKeyId,
21 const query = Object.fromEntries(searchParams.entries());
22 if (pathname === "/" && query.url) {
23 const resp = await signedFetch(query.url, {
24 headers: { accept: "application/activity+json" },
25 });

gsheet_callmain.tsx2 matches

@hiteshjoshi•Updated 1 year ago
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=41";
2
3export const gsheet_call = async (service_account, sheet_id, method, action, data) => {
9 };
10 const token = await getToken(service_account, googleAuthOptions);
11 const result = fetchJSON(
12 `https://sheets.googleapis.com/v4/spreadsheets/${sheet_id}/${action}`,
13 {

fetchNewestValsmain.tsx1 match

@vladimyr•Updated 1 year ago
36});
37
38export async function fetchNewestVals({ page = 0 } = {}) {
39 const url = new URL("https://www.val.town/newest");
40 url.searchParams.set("_data", "routes/_app.newest");

fetchValmain.tsx1 match

@vladimyr•Updated 1 year ago
24});
25
26export async function fetchVal(author: string, name: string) {
27 const prefixUrl = new URL("/v1/alias", API_URL);
28 const resp = await ky.get(`${author}/${name}`, { prefixUrl }).json();

fetchTextmain.tsx4 matches

@vladimyr•Updated 1 year ago
1import { normalizeURL } from "https://esm.town/v/stevekrouse/normalizeURL";
2
3export const fetchText = async (
4 url: string | URL,
5 options?: RequestInit & {
6 bearer?: string;
7 fetch?: typeof fetch;
8 },
9) => {
13 headers.set("authorization", `Bearer ${options.bearer}`);
14 }
15 let fetch = options?.fetch ?? globalThis.fetch;
16 let resp = await fetch(url, {
17 redirect: "follow",
18 ...options,

fetchJSONmain.tsx5 matches

@vladimyr•Updated 1 year ago
1import { fetchText } from "https://esm.town/v/stevekrouse/fetchText";
2
3export const fetchJSON = async (
4 url: string | URL,
5 options?: RequestInit & {
6 bearer?: string;
7 fetch?: typeof fetch;
8 },
9) => {
10 let headers = new Headers(options?.headers ?? {});
11 headers.set("accept", "application/json");
12 let text = await fetchText(url, {
13 ...options,
14 headers,
17 return JSON.parse(text);
18 } catch (e) {
19 throw new Error(`fetchJSON error: ${e.message} in ${url}\n\n"${text}"`);
20 }
21};

gsheet_callmain.tsx2 matches

@apois•Updated 1 year ago
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=41";
2
3export const gsheet_call = async (service_account, sheet_id, method, action, data) => {
9 };
10 const token = await getToken(service_account, googleAuthOptions);
11 const result = fetchJSON(
12 `https://sheets.googleapis.com/v4/spreadsheets/${sheet_id}/${action}`,
13 {

emeraldDragonmain.tsx9 matches

@pomdtr•Updated 1 year ago
1/**
2 * Fetches JSON data from a URL.
3 * @async
4 * @param {string | URL} url - The URL to fetch JSON data from.
5 * @param {RequestInit & { bearer?: string; fetch?: typeof fetch }} [options] - Additional options for the fetch.
6 * @returns {Promise<any>} - A Promise that resolves to the fetched JSON data.
7 */
8export const fetchJSON = async (
9 url: string | URL,
10 options?: RequestInit & { bearer?: string; fetch?: typeof fetch },
11) => {
12 let headers = new Headers(options?.headers ?? {});
15 headers.set("authorization", `Bearer ${options.bearer}`);
16 }
17 let fetch = options?.fetch ?? globalThis.fetch;
18 let resp = await fetch(normalizeURL(url), {
19 redirect: "follow",
20 ...options,
26 }
27 catch (e) {
28 throw new Error(`fetchJSON error: ${e.message} in ${url}\n\n"${text}"`);
29 }
30};

GithubPRFetcher

@andybak•Updated 2 days ago

proxiedfetch1 file match

@jayden•Updated 3 days ago