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=504&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 7880 results for "fetch"(1203ms)

zestyPurplePandamain.tsx1 match

@niek•Updated 7 months ago
13});
14
15export default app.fetch;

zestyPurplePandaREADME.md2 matches

@niek•Updated 7 months ago
1# Fetch Template
2Example template to quickly get started with a backend for Fetch in Framer.

Fetchmain.tsx1 match

@niek•Updated 7 months ago
14});
15
16export default app.fetch;

blob_adminmain.tsx2 matches

@rmhsilva•Updated 7 months ago
1/** @jsxImportSource https://esm.sh/hono@4.0.8/jsx **/
2
3import { modifyFetchHandler } from "https://esm.town/v/andreterron/codeOnValTown?v=50";
4import view_route from "https://esm.town/v/pomdtr/blob_admin_blob";
5import create_route from "https://esm.town/v/pomdtr/blob_admin_create";
137});
138
139export default modifyFetchHandler(passwordAuth(app.fetch));

createGitHubContribGraphmain.tsx12 matches

@tmcw•Updated 7 months ago
184
185 useEffect(() => {
186 fetchContributions()
187 }, [])
188
189 const fetchContributions = async () => {
190 setError(null)
191 setContributionData(null)
192 setUserData(null)
193 try {
194 const response = await fetch("/contributions", {
195 method: "POST",
196 headers: { "Content-Type": "application/json" },
197 body: JSON.stringify({ username }),
198 })
199 if (!response.ok) throw new Error("Failed to fetch contributions")
200 const data = await response.json()
201 console.log("Fetched data:", data)
202 setContributionData(data.contributionCalendar)
203 setUserData(data.user)
204 } catch (err) {
205 console.error("Error fetching contributions:", err)
206 setError(err.message)
207 }
237 const handleKeyPress = (event) => {
238 if (event.key === "Enter") {
239 fetchContributions()
240 }
241 }
309 placeholder="Enter GitHub username"
310 />
311 <button onClick={fetchContributions}>Fetch Commits</button>
312 </div>
313 {error && <p className="error">{error}</p>}
368 if (request.method === "POST" && new URL(request.url).pathname === "/contributions") {
369 const { username } = await request.json()
370 const contributionData = await fetchGitHubContributions(username)
371 return new Response(JSON.stringify(contributionData), {
372 headers: { "Content-Type": "application/json" },
395}
396
397async function fetchGitHubContributions(username: string) {
398 const query = `
399 query($username: String!) {
417 `
418
419 const response = await fetch("https://api.github.com/graphql", {
420 method: "POST",
421 headers: {
427
428 if (!response.ok) {
429 throw new Error("Failed to fetch GitHub data")
430 }
431

immenseBlushSpidermain.tsx6 matches

@ngmi•Updated 7 months ago
9 error = "API key is not set. Please configure the FARCASTER_API_KEY environment variable.";
10 } else {
11 async function fetchFeedItems() {
12 try {
13 const response = await fetch(`${API_URL}?limit=50`, {
14 headers: {
15 'API-KEY': API_KEY,
30 }
31 } catch (e) {
32 console.error("Error fetching feed items:", e);
33 throw e;
34 }
37 if (request.method === 'POST') {
38 try {
39 feedItems = await fetchFeedItems();
40 return new Response(JSON.stringify(feedItems), {
41 headers: { "Content-Type": "application/json" }
49 } else {
50 try {
51 feedItems = await fetchFeedItems();
52 } catch (e) {
53 error = e.message;
96 document.getElementById('refreshButton').addEventListener('click', async () => {
97 try {
98 const response = await fetch('', { method: 'POST' });
99 if (!response.ok) throw new Error('Network response was not ok');
100 const feedItems = await response.json();

naughtyRedTunamain.tsx8 matches

@maxjoygit•Updated 7 months ago
3import { email } from "https://esm.town/v/std/email";
4
5async function fetchStories(type: string, count: number) {
6 const response = await fetch(`https://hacker-news.firebaseio.com/v0/${type}stories.json`);
7 const storyIds = await response.json();
8 const stories = await Promise.all(
9 storyIds.slice(0, count).map(async (id: number) => {
10 const storyResponse = await fetch(`https://hacker-news.firebaseio.com/v0/item/${id}.json`);
11 return storyResponse.json();
12 }),
120export default async function server(req: Request) {
121 try {
122 const topStories = await fetchStories("top", 10);
123 const newStories = await fetchStories("new", 5);
124 const showStories = await fetchStories("show", 3);
125 const askStories = await fetchStories("ask", 3);
126 const jobStories = await fetchStories("job", 3);
127
128 const emailContent = createEmailContent(topStories, newStories, showStories, askStories, jobStories);

hackerNewsDigestmain.tsx8 matches

@maxjoygit•Updated 7 months ago
3import { email } from "https://esm.town/v/std/email";
4
5async function fetchStories(type: string, count: number) {
6 const response = await fetch(`https://hacker-news.firebaseio.com/v0/${type}stories.json`);
7 const storyIds = await response.json();
8 const stories = await Promise.all(
9 storyIds.slice(0, count).map(async (id: number) => {
10 const storyResponse = await fetch(`https://hacker-news.firebaseio.com/v0/item/${id}.json`);
11 return storyResponse.json();
12 }),
120export default async function server(req: Request) {
121 try {
122 const topStories = await fetchStories("top", 10);
123 const newStories = await fetchStories("new", 5);
124 const showStories = await fetchStories("show", 3);
125 const askStories = await fetchStories("ask", 3);
126 const jobStories = await fetchStories("job", 3);
127
128 const emailContent = createEmailContent(topStories, newStories, showStories, askStories, jobStories);

hackerNewsDigestmain.tsx8 matches

@citizen428•Updated 7 months ago
3import { email } from "https://esm.town/v/std/email";
4
5async function fetchStories(type: string, count: number) {
6 const response = await fetch(`https://hacker-news.firebaseio.com/v0/${type}stories.json`);
7 const storyIds = await response.json();
8 const stories = await Promise.all(
9 storyIds.slice(0, count).map(async (id: number) => {
10 const storyResponse = await fetch(`https://hacker-news.firebaseio.com/v0/item/${id}.json`);
11 return storyResponse.json();
12 }),
120export default async function server(req: Request) {
121 try {
122 const topStories = await fetchStories("top", 10);
123 const newStories = await fetchStories("new", 5);
124 const showStories = await fetchStories("show", 3);
125 const askStories = await fetchStories("ask", 3);
126 const jobStories = await fetchStories("job", 3);
127
128 const emailContent = createEmailContent(topStories, newStories, showStories, askStories, jobStories);

git_jiggymain.tsx12 matches

@stevekrouse•Updated 7 months ago
32
33 useEffect(() => {
34 fetchContributions();
35 }, []);
36
37 const fetchContributions = async () => {
38 setError(null);
39 setContributionData(null);
40 setUserData(null);
41 try {
42 const response = await fetch("/contributions", {
43 method: "POST",
44 headers: { "Content-Type": "application/json" },
45 body: JSON.stringify({ username }),
46 });
47 if (!response.ok) throw new Error("Failed to fetch contributions");
48 const data = await response.json();
49 console.log("Fetched data:", data);
50 setContributionData(data.contributionCalendar);
51 setUserData(data.user);
52 } catch (err) {
53 console.error("Error fetching contributions:", err);
54 setError(err.message);
55 }
248 const handleKeyPress = (event) => {
249 if (event.key === "Enter") {
250 fetchContributions();
251 }
252 };
272 placeholder="Enter GitHub username"
273 />
274 <button onClick={fetchContributions}>Fetch Commits</button>
275 </div>
276 {error && <p className="error">{error}</p>}
331 if (request.method === "POST" && new URL(request.url).pathname === "/contributions") {
332 const { username } = await request.json();
333 const contributionData = await fetchGitHubContributions(username);
334 return new Response(JSON.stringify(contributionData), {
335 headers: { "Content-Type": "application/json" },
359}
360
361async function fetchGitHubContributions(username: string) {
362 const query = `
363 query($username: String!) {
381 `;
382
383 const response = await fetch("https://api.github.com/graphql", {
384 method: "POST",
385 headers: {
391
392 if (!response.ok) {
393 throw new Error("Failed to fetch GitHub data");
394 }
395

fetchPaginatedData2 file matches

@nbbaier•Updated 1 week ago

FetchBasic1 file match

@fredmoon•Updated 1 week ago