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/$%7Burl%7D?q=fetch&page=836&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 11133 results for "fetch"(1424ms)

cisaKEVToRSSmain.tsx2 matches

@hrbrmstr•Updated 8 months ago
70export async function handler(req: Request): Promise<Response> {
71 try {
72 const response = await fetch(CISA_JSON_URL);
73
74 if (!response.ok) {
75 throw new Error(`Failed to fetch data: ${response.status} ${response.statusText}`);
76 }
77

eagerIndigoPigmain.tsx8 matches

@nickaggarwal•Updated 8 months ago
20 for (const topic of KEYWORDS) {
21 const results = await Promise.allSettled([
22 fetchHackerNewsResults(topic),
23 fetchTwitterResults(topic),
24 fetchRedditResults(topic),
25 ]);
26
49}
50
51// Fetch Hacker news, Twitter, and Reddit results
52async function fetchHackerNewsResults(topic: string): Promise<Website[]> {
53 return hackerNewsSearch({
54 query: topic,
58}
59
60async function fetchTwitterResults(topic: string): Promise<Website[]> {
61 return twitterSearch({
62 query: topic,
67}
68
69async function fetchRedditResults(topic: string): Promise<Website[]> {
70 return redditSearch({ query: topic });
71}
84 }
85
86 const response = await fetch(slackWebhookUrl, {
87 method: "POST",
88 headers: { "Content-Type": "application/json" },

slackScoutmain.tsx8 matches

@nickaggarwal•Updated 8 months ago
20 for (const topic of KEYWORDS) {
21 const results = await Promise.allSettled([
22 fetchHackerNewsResults(topic),
23 fetchTwitterResults(topic),
24 fetchRedditResults(topic),
25 ]);
26
49}
50
51// Fetch Hacker news, Twitter, and Reddit results
52async function fetchHackerNewsResults(topic: string): Promise<Website[]> {
53 return hackerNewsSearch({
54 query: topic,
58}
59
60async function fetchTwitterResults(topic: string): Promise<Website[]> {
61 return twitterSearch({
62 query: topic,
67}
68
69async function fetchRedditResults(topic: string): Promise<Website[]> {
70 return redditSearch({ query: topic });
71}
84 }
85
86 const response = await fetch(slackWebhookUrl, {
87 method: "POST",
88 headers: { "Content-Type": "application/json" },

ForexDataHubmain.tsx2 matches

@samweist•Updated 8 months ago
103 let calendarEvents;
104 try {
105 const response = await fetch(new URL("/api/calendar", request.url));
106 calendarEvents = await response.json();
107 if (!Array.isArray(calendarEvents)) {
109 }
110 } catch (error) {
111 console.error("Error fetching calendar events:", error);
112 calendarEvents = []; // Use an empty array if there's an error
113 }

recordWebsitePreparermain.tsx1 match

@willthereader•Updated 8 months ago
14 e.preventDefault();
15 setLoading(true);
16 const response = await fetch("/", {
17 method: "POST",
18 headers: { "Content-Type": "application/json" },
53 try {
54 console.log(`Processing line ${i + 1}: ${lines[i]}`);
55 const response = await fetch("/convert", {
56 method: "POST",
57 headers: { "Content-Type": "application/json" },

alchemyClientmain.tsx3 matches

@jamiedubs•Updated 8 months ago
1import { fetch } from "https://esm.town/v/std/fetch";
2import process from "node:process";
3
4type TokenParam = "erc20" | "nft" | string;
5
6export async function alchemyFetch(path: string, tokens: TokenParam = "erc20") {
7 const apiKey = process.env.ALCHEMY_API_KEY;
8 if (!apiKey) throw new Error("missing ALCHEMY_API_KEY");
10 const rpcUrl = `${baseUrl}/${apiKey}`;
11 const url = `${rpcUrl}/${path}`;
12 const response = await fetch(url, {
13 method: "GET",
14 headers: {

ethereumTokenBalancesmain.tsx3 matches

@jamiedubs•Updated 8 months ago
1import { alchemyFetch } from "https://esm.town/v/jamiedubs/alchemyClient";
2
3export async function getBalances(address: string) {
4 const [tokens, eth] = await Promise.all([
5 alchemyFetch(`getTokenBalances?address=${address}`),
6 alchemyFetch(`getBalance?address=${address}`),
7 ]);
8 return { tokens, eth };

bioFeelermain.tsx11 matches

@o_sv•Updated 8 months ago
31
32 useEffect(() => {
33 fetchLeaderboard();
34 }, []);
35
36 const fetchLeaderboard = async () => {
37 const response = await fetch("/leaderboard");
38 if (response.ok) {
39 const data = await response.json();
44 const handleSubmit = async (e) => {
45 e.preventDefault();
46 const response = await fetch("/submit", {
47 method: "PUT",
48 headers: { "Content-Type": "application/json" },
57 const handleRate = async (category, value) => {
58 setRatings(prev => ({ ...prev, [category]: value }));
59 await fetch("/rate", {
60 method: "POST",
61 headers: { "Content-Type": "application/json" },
64 };
65
66 const fetchBioToRate = async () => {
67 const response = await fetch("/bio");
68 if (response.ok) {
69 const data = await response.json();
94 const hashedPassword = Hex.stringify(sha256(password));
95 if (hashedPassword === PASSWORD_HASH) {
96 const response = await fetch("/clear-bios", {
97 method: "POST",
98 headers: { "Content-Type": "application/json" },
101 if (response.ok) {
102 alert("All bios have been cleared.");
103 fetchLeaderboard(); // Refresh the leaderboard
104 } else {
105 alert("Failed to clear bios. Please try again.");
113 useEffect(() => {
114 if (view === "rate") {
115 fetchBioToRate();
116 }
117 }, [view]);
193 </div>
194 ))}
195 <button onClick={fetchBioToRate}>Next Bio</button>
196 <button onClick={() => setView("home")}>Back to Home</button>
197 </div>

ThumbMakermain.tsx1 match

@g•Updated 8 months ago
394app.get('/main.js', serve(js, 'text/javascript'));
395
396export default app.fetch;

fetch_template2 file matches

@gwoods22•Updated 21 hours ago

HN-fetch-call3 file matches

@ImGqb•Updated 2 days ago
fetch HackerNews by API