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=747&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 7885 results for "fetch"(1087ms)

resyVenueIdFromSlugAndCitymain.tsx2 matches

@vtdocs•Updated 1 year ago
1import { fetch } from "https://esm.town/v/std/fetch";
2import { resyPublicAPIKey } from "https://esm.town/v/vtdocs/resyPublicAPIKey";
3
9 id: number;
10}> => {
11 const venueRes = await fetch(
12 `https://api.resy.com/3/venue?url_slug=${slug}&location=${city}`,
13 {

weatherTestmain.tsx2 matches

@ktm•Updated 1 year ago
1import { fetch } from "https://esm.town/v/std/fetch";
2
3export async function weatherTest(lat, long) {
5 const URL = `https://api.weather.gov/points/${lat},${long}`;
6 return URL;
7 const res = await fetch(URL);
8 const jsonData = await res.json();
9 console.log(jsonData.properties.timeZone);

callPrivateAPImain.tsx2 matches

@galligan•Updated 1 year ago
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=41";
2
3export let callPrivateAPI = async ({ handle, val, method = "GET", secret }) => {
11 const valTownUrl = "https://api.val.town/v1/run/" + endpoint;
12 // Make an authenticated request to Val Town API
13 const response = await fetchJSON(valTownUrl, {
14 method,
15 headers: {

htmxTimedmain.tsx1 match

@neverstew•Updated 1 year ago
41 <li><p>New item</p></li>
42 `));
43 const response = await app.fetch(request);
44 const afterResponse = performance.now() - afterHono;
45 console.log("after response", afterResponse);

deleteValmain.tsx2 matches

@neverstew•Updated 1 year ago
1import { fetch } from "https://esm.town/v/std/fetch";
2
3export function deleteVal({ token, id }: {
5 id: string;
6}): Promise<Response> {
7 return fetch("https://api.val.town/v1/vals/" + id, {
8 headers: {
9 Authorization: `Bearer ${token}`,

kbrmain.tsx3 matches

@bert•Updated 1 year ago
1import { fetch } from "https://esm.town/v/std/fetch";
2
3export const kbr = async () => {
5 const itemId = "B/9/9/1/2/4/2/1/0000-00-00_00";
6 const imageId = "BE-KBR00_B-19912421_0000-00-00_00_0001";
7 const fetchText = (url) => fetch(url).then((response) => response.text());
8 const url = `${baseUrl}/${itemId}/${imageId}.txt`;
9 const dimensions = await fetchText(url);
10 return dimensions.split("x").map((c) => Number(c));
11};

fetchJSONmain.tsx4 matches

@mgruel•Updated 1 year ago
1import { fetch } from "https://esm.town/v/std/fetch";
2
3export const fetchJSON = <T extends any = any>(
4 url: string | URL,
5 options?: RequestInit,
6): Promise<T> =>
7 fetch(url, {
8 redirect: "follow",
9 ...options,
10 }).then((r) => r.json() as T);
11// Forked from @stevekrouse.fetchJSON

measureValTownE2emain.tsx3 matches

@healeycodes•Updated 1 year ago
1import { fetch } from "https://esm.town/v/std/fetch";
2
3// E.g. from a user's perspective (not the real execution time!)
8 for (let i = 0; i < count; i++) {
9 let start = Date.now();
10 await fetch("https://api.val.town/eval/(()=%3E1+1)()");
11 evalTimes.push(Date.now() - start);
12 }
23 for (let i = 0; i < count; i++) {
24 let start = Date.now();
25 await fetch("https://api.val.town/eval/@healeycodes.addOnes()");
26 userFuncTimes.push(Date.now() - start);
27 }

forceUnsubmain.tsx2 matches

@mihir•Updated 1 year ago
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=41";
2import { getGoogleAccessTokenFromRefreshToken } from "https://esm.town/v/mihir/getGoogleAccessTokenFromRefreshToken";
3
8 const from = emails.join(" OR ");
9
10 return fetchJSON(
11 "https://gmail.googleapis.com/gmail/v1/users/me/settings/filters",
12 {

boredActivitiesmain.tsx2 matches

@andreterron•Updated 1 year ago
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=41";
2
3// Activity suggestions for when you're bored
4export let boredActivities = fetchJSON('https://www.boredapi.com/api/activity')

fetchPaginatedData2 file matches

@nbbaier•Updated 1 week ago

FetchBasic1 file match

@fredmoon•Updated 1 week ago