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=689&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 8446 results for "fetch"(1679ms)

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};

list_newest_vals_actionmain.tsx2 matches

@pomdtr•Updated 1 year ago
1import { ListItem } from "https://esm.town/v/pomdtr/browser";
2import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=44";
3
4export default async function() {
5 const { vals } = await fetchJSON("https://www.val.town/newest?page=0&_data=routes/_app.newest");
6
7 const items = vals.map(val => {

fetchJSONmain.tsx5 matches

@pomdtr•Updated 1 year ago
1import { normalizeURL } from "https://esm.town/v/stevekrouse/normalizeURL";
2
3export const fetchJSON = 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(normalizeURL(url), {
17 redirect: "follow",
18 ...options,
24 }
25 catch (e) {
26 throw new Error(`fetchJSON error: ${e.message} in ${url}\n\n"${text}"`);
27 }
28};

amaranthYakmain.tsx3 matches

@stevekrouse•Updated 1 year ago
1/** @jsxImportSource https://esm.sh/hono@latest/jsx **/
2import { modifyFetchHandler } from "https://esm.town/v/andreterron/codeOnValTown?v=50";
3import { resetStyle } from "https://esm.town/v/nbbaier/resetStyle";
4import { sqlToCSV, sqlToJSON } from "https://esm.town/v/nbbaier/sqliteExportHelpers";
147});
148
149export const handler = app.fetch;
150
151export default modifyFetchHandler(passwordAuth(handler));

fetchPaginatedData2 file matches

@nbbaier•Updated 2 weeks ago

FetchBasic1 file match

@fredmoon•Updated 2 weeks ago