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=753&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"(1665ms)

extractOnThisDayStorymain.tsx4 matches

@fab1an•Updated 1 year ago
1import { fetch } from "https://esm.town/v/std/fetch";
2
3export const extractOnThisDayStory = async () => {
12 `https://api.wikimedia.org/feed/v1/wikipedia/en/onthisday/all/${MM}/${DD}`;
13 try {
14 const response = await fetch(url);
15 const data = await response.json();
16 const newsEvents = data.events; // We assume that 'events' category is most likely to contain news articles.
24 }
25 catch (error) {
26 console.log("Error fetching On This Day content:", error);
27 return `An error occurred while fetching the On This Day content. ${error}`;
28 }
29 };

staleGithubPRsmain.tsx2 matches

@ramkarthik•Updated 1 year ago
1import { daysAgoFromToday } from "https://esm.town/v/ramkarthik/daysAgoFromToday";
2import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=41";
3
4export const staleGithubPRs = async (
14 },
15 };
16 let data = await fetchJSON(
17 `https://api.github.com/repos/${owner}/${repo}/pulls`,
18 options,

raindropBookmarksmain.tsx2 matches

@ramkarthik•Updated 1 year ago
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=41";
2
3export const raindropBookmarks = async (
8 "headers": { "Authorization": "Bearer " + raindropToken },
9 };
10 let data = await fetchJSON(
11 "https://api.raindrop.io/rest/v1/raindrops/0?perpage=20&page=" + page,
12 options,

githubUsermain.tsx2 matches

@potherca•Updated 1 year ago
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=41";
2
3// Github profile
4export let githubUser = fetchJSON(
5 "https://api.github.com/users/stevekrouse"
6);

nasaAPODmain.tsx2 matches

@fdurham•Updated 1 year ago
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=41";
2
3// Returns NASA's Astronomy Picture of the Day (APOD)
4export const nasaAPOD = fetchJSON("cutt.ly/T7ksirK");
5// Forked from @iBrokeit.nasaAPOD

polygonDailyAPImain.tsx2 matches

@rwev•Updated 1 year ago
1import process from "node:process";
2import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=41";
3
4export async function polygonDailyAPI(ticker, date) {
5 return fetchJSON(
6 `https://api.polygon.io/v1/open-close/${ticker}/${date}?adjusted=true&apiKey=${process.env.POLYGON_API_KEY}`
7 );

githubUsermain.tsx2 matches

@bitbloxhub•Updated 1 year ago
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=41";
2
3// Github profile
4export let githubUser = fetchJSON(
5 "https://api.github.com/users/stevekrouse"
6);

tldrawStarsmain.tsx2 matches

@jamie_tldraw•Updated 1 year ago
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=41";
2
3export let tldrawStars = fetchJSON("https://api.github.com/repos/tldraw/tldraw")
4 .then(
5 (resp) =>

slackReplyToMessagemain.tsx2 matches

@neverstew•Updated 1 year ago
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=41";
2import process from "node:process";
3
16 // Note: `body.event` has information about the event
17 // like the sender and the message text
18 const result = await fetchJSON(
19 "https://slack.com/api/chat.postMessage",
20 {

fetchJSONmain.tsx4 matches

@sean•Updated 1 year ago
1import { fetch } from "https://esm.town/v/std/fetch";
2
3export const fetchJSON = async <T = any>(url: string, options?: any): Promise<T> => {
4 try {
5 const response = await fetch(url, {
6 ...options,
7 headers: {
13 return response.json();
14 } catch (error) {
15 throw new Error(`${error.message} in fetch ${url}."`);
16 }
17};

fetchPaginatedData2 file matches

@nbbaier•Updated 1 week ago

FetchBasic1 file match

@fredmoon•Updated 1 week ago