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=70&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 3475 results for "fetch"(347ms)

belle-energie-checkergetEtag.ts3 matches

@pom421•Updated 1 week ago
8
9export const getEtag = async (): Promise<OutputType> => {
10 const response = await fetch(url, {
11 method: "HEAD",
12 headers: {
17 if (!response.ok) {
18 console.error(
19 `Error fetching ETag: ${response.status} ${response.statusText}`,
20 );
21 return {
22 success: false,
23 error: `FETCHING_ERROR`,
24 };
25 }

MiniAppStarterneynar.ts14 matches

@hashbrown•Updated 1 week ago
1const baseUrl = "https://api.neynar.com/v2/farcaster/";
2
3export async function fetchNeynarGet(path: string) {
4 const res = await fetch(baseUrl + path, {
5 method: "GET",
6 headers: {
14}
15
16export function fetchUser(username: string) {
17 return fetchNeynarGet(`user/by_username?username=${username}`).then(r => r.user);
18}
19export function fetchUsersById(fids: string) {
20 return fetchNeynarGet(`user/bulk?fids=${fids}`).then(r => r.users);
21}
22
23export function fetchUserFeed(fid: number) {
24 return fetchNeynarGet(
25 `feed?feed_type=filter&filter_type=fids&fids=${fid}&with_recasts=false&with_replies=false&limit=100&cursor=`,
26 ).then(r => r.casts);
27}
28
29export function fetchChannel(channelId: string) {
30 return fetchNeynarGet(`channel?id=${channelId}`).then(r => r.channel);
31}
32
33export function fetchChannelFeed(channelId: string) {
34 return fetchNeynarGet(
35 `feed/channels?channel_ids=${channelId}&with_recasts=false&limit=100`,
36 ).then(r => r.casts);
37}
38
39export function fetchChannelsFeed(channelIds: array) {
40 return fetchNeynarGet(
41 `feed/channels?channel_ids=${channelIds.join(",")}&with_recasts=false&limit=100`,
42 ).then(r => r.casts);

MiniAppStarterindex.tsx2 matches

@hashbrown•Updated 1 week ago
63});
64
65// HTTP vals expect an exported "fetch handler"
66// This is how you "run the server" in Val Town with Hono
67export default app.fetch;

MiniAppStarterimage.tsx2 matches

@hashbrown•Updated 1 week ago
75 const fontPromises = fontsConfig.map(async (font) => {
76 const fontUrl = "https://cdn.jsdelivr.net/npm/@tamagui/font-inter@1.108.3/otf/" + font.fontFile;
77 const fontArrayBuf = await fetch(fontUrl).then((res) => res.arrayBuffer());
78 return { name: font.name, data: fontArrayBuf, weight: font.weight };
79 });
86 // const api = `https://cdnjs.cloudflare.com/ajax/libs/twemoji/14.0.2/svg/${code.toLowerCase()}.svg`
87 const api = `https://cdn.jsdelivr.net/gh/shuding/fluentui-emoji-unicode/assets/${code.toLowerCase()}_color.svg`;
88 return fetch(api).then((r) => r.text());
89};
90

MiniAppStarterHome.tsx1 match

@hashbrown•Updated 1 week ago
7
8import { Button, Input, Section } from "../components/ui.tsx";
9import { fetchUsersById } from "../util/neynar.ts";
10
11export function Home() {
41
42async function sendNotification(notificationDetails: any, payload: any) {
43 return await fetch(notificationDetails.url, {
44 method: "POST",
45 headers: { "Content-Type": "application/json" },

MiniAppStarterApp.tsx5 matches

@hashbrown•Updated 1 week ago
8import { FarcasterMiniApp } from "./components/FarcasterMiniApp.tsx";
9import { Button, Section } from "./components/ui.tsx";
10import { fetchNeynarGet } from "./util/neynar.ts";
11
12export function App() {
67
68function Database() {
69 const queryFn = () => fetch("/api/counter/get").then((r) => r.json());
70 const { data, refetch } = useQuery({ queryKey: ["counter"], queryFn });
71 return (
72 <Section className="flex flex-col items-start gap-3 m-5">
73 {/* <h2 className="font-semibold">Database Example</h2> */}
74 <div className="">Counter value: {data}</div>
75 <Button variant="outline" onClick={() => fetch("/api/counter/increment").then(refetch)}>
76 Increment
77 </Button>
82function Neynar() {
83 useEffect(() => {
84 fetchNeynarGet("user/by_username?username=moe").then(console.log).catch(console.error);
85 }, []);
86

belle-energie-checkercheckNewTarif.ts5 matches

@pom421•Updated 1 week ago
22 if (!getEtagResponse.success) {
23 console.error(
24 `Error fetching ETag: ${getEtagResponse.error}`,
25 );
26 sendEmailErrorCron(`Error fetching ETag: ${getEtagResponse.error}`);
27 return;
28 }
32 if (!getLastEvtResponse.success) {
33 console.error(
34 `Error fetching last event: ${getLastEvtResponse.error}`,
35 );
36 sendEmailErrorCron(
37 `Error fetching last event: ${getLastEvtResponse.error}`,
38 );
39 return;
73 }
74 } catch (error) {
75 console.error("Error fetching endpoint:", error);
76 }
77}

Bates_bottesttelegram1 match

@greasegum•Updated 1 week ago
10
11 try {
12 const response = await fetch(url, {
13 method: "POST",
14 headers: {

reactHonoStarterindex.ts2 matches

@pom421•Updated 1 week ago
21});
22
23// HTTP vals expect an exported "fetch handler"
24// This is how you "run the server" in Val Town with Hono
25export default app.fetch;

fetchPaginatedData2 file matches

@nbbaier•Updated 1 week ago

tweetFetcher2 file matches

@nbbaier•Updated 1 week ago