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=726&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 8134 results for "fetch"(1947ms)

nearestOpenStationmain.tsx3 matches

@guscuddy•Updated 1 year ago
1import { fetch } from "https://esm.town/v/std/fetch";
2
3export const nearestOpenStation = async ({ lon, lat }) => {
9 );
10 }
11 const { data: { stations: stationInfo } } = await fetch(
12 "https://gbfs.citibikenyc.com/gbfs/en/station_status.json",
13 ).then((r) => r.json());
15 stationInfo.map((info) => [info.station_id, info]),
16 );
17 const { data: { stations } } = await fetch(
18 "https://gbfs.citibikenyc.com/gbfs/en/station_information.json",
19 ).then((r) => r.json());

telegramSetWebhookmain.tsx2 matches

@vtdocs•Updated 1 year ago
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=41";
2
3export const telegramSetWebhook = async (botToken: string, options: {
9 secret_token?: string;
10}) =>
11 fetchJSON(
12 `https://api.telegram.org/bot${botToken}/setWebhook`,
13 {

exampleExpressPOSTmain.tsx2 matches

@vtdocs•Updated 1 year ago
1import { fetchText } from "https://esm.town/v/stevekrouse/fetchText?v=5";
2
3export const exampleExpressPOST = fetchText(
4 "https://api.val.town/v1/express/stevekrouse.expressHTMLExample",
5 { method: "POST", body: JSON.stringify({ name: "Docs" }) },

browserlessScrapeExamplemain.tsx2 matches

@vtdocs•Updated 1 year ago
1import process from "node:process";
2import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=41";
3
4export const browserlessScrapeExample = (async () => {
5 const res = await fetchJSON(
6 `https://chrome.browserless.io/scrape?token=${process.env.browserlessKey}`,
7 {

handlePostmain.tsx2 matches

@cp1•Updated 1 year ago
1import { fetch } from "https://esm.town/v/std/fetch";
2
3export const handlePost = async (req: express.Request, res: express.Response) => {
4 const { url = "http://example.com", method = "GET", headers = {} } = req.body;
5 const resp = await fetch(url, {
6 redirect: "follow",
7 });

valVersionmain.tsx2 matches

@neverstew•Updated 1 year ago
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=41";
2
3export function valVersion({ token, id, version }: {
30 }
31 : {};
32 return fetchJSON(
33 `https://api.val.town/v1/vals/${id}/versions/${version}`,
34 { headers },

kbrImagemain.tsx2 matches

@bert•Updated 1 year ago
1import { fetch } from "https://esm.town/v/std/fetch";
2
3export const kbrImage = async () => {
4 const url =
5 "https://viewerd.kbr.be/display/B/9/9/1/2/4/2/1/0000-00-00_00/zoomtiles/BE-KBR00_B-19912421_0000-00-00_00_0001/5-43-7.jpg";
6 return await fetch(url);
7 // .then((response) => )
8};

parseHtmlmain.tsx2 matches

@johndaly•Updated 1 year ago
1import { fetch } from "https://esm.town/v/std/fetch";
2
3export async function parseHtml(url: string) {
5 "https://deno.land/x/deno_dom/deno-dom-wasm.ts"
6 );
7 const response = await fetch(url);
8 const text = await response.text();
9 const parsed = new DOMParser().parseFromString(text, "text/html");

hnTopStoriesmain.tsx6 matches

@axelav•Updated 1 year ago
1import { fetch } from "https://esm.town/v/std/fetch";
2
3export let // View this in a web browser!
5// https://api3.val.town/express/async%20(req,%20res)%20=%3Eres.send(@healeycodes.hnTopStories)
6const hnTopStories = (async () => {
7 let valTownFetchLimit = 100;
8 const topStories: Number[] = await fetch(
9 "https://hacker-news.firebaseio.com/v0/topstories.json?print=pretty"
10 ).then((res) => res.json());
11 valTownFetchLimit--;
12 const topStoriesData: Promise<{
13 title: string;
14 url: string;
15 }>[] = topStories.slice(0, valTownFetchLimit).map(async (id) => {
16 return await fetch(
17 `https://hacker-news.firebaseio.com/v0/item/${id}.json?print=pretty`
18 ).then((res) => res.json());

discogsmain.tsx4 matches

@axelav•Updated 1 year ago
1import { fetchJSON } from "https://esm.town/v/axelav/fetchJSON";
2import process from "node:process";
3
85 results: DiscogsRelease[];
86 }> =>
87 fetchJSON(
88 `https://api.discogs.com/database/search?token=${token}&q=${query}${
89 isMaster ? "&type=master" : ""
91 );
92 const getMasterRelease = async (id: string): Promise<DiscogsRelease> =>
93 fetchJSON(
94 `https://api.discogs.com/masters/${id}?token=${token}`
95 );
96 const getMainRelease = async (id: string): Promise<DiscogsRelease> =>
97 fetchJSON(
98 `https://api.discogs.com/releases/${id}?token=${token}`
99 );

fetchPaginatedData2 file matches

@nbbaier•Updated 1 week ago

FetchBasic1 file match

@fredmoon•Updated 1 week ago