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/$%7Bsuccess?q=fetch&page=637&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 9207 results for "fetch"(1699ms)

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

imgGenUrlmain.tsx1 match

@ibodev•Updated 7 months ago
14 await blob.setJSON(genKey(key), url);
15 }
16 return new Response((await fetch(url)).body, { headers: { "content-type": "image/jpg" } });
17}

BrowserbaseFetcherFromURLREADME.md1 match

@willthereader•Updated 7 months ago
1Migrated from folder: fanficSearcher/BrowserBaseAttempt/BrowserbaseFetcherFromURL

sqliteExplorerAppmain.tsx4 matches

@florian42•Updated 7 months ago
1/** @jsxImportSource https://esm.sh/hono@latest/jsx **/
2
3import { modifyFetchHandler } from "https://esm.town/v/andreterron/codeOnValTown?v=50";
4import { iframeHandler } from "https://esm.town/v/nbbaier/iframeHandler";
5import { resetStyle } from "https://esm.town/v/nbbaier/resetStyle";
16import { verifyToken } from "https://esm.town/v/pomdtr/verifyToken";
17import { ResultSet, sqlite } from "https://esm.town/v/std/sqlite";
18import { reloadOnSaveFetchMiddleware } from "https://esm.town/v/stevekrouse/reloadOnSave";
19import { Hono } from "npm:hono";
20import type { FC } from "npm:hono/jsx";
175});
176
177export const handler = app.fetch;
178export default iframeHandler(modifyFetchHandler(passwordAuth(handler, { verifyPassword: verifyToken })));

excaliGridmain.tsx4 matches

@all•Updated 7 months ago
39
40 useEffect(() => {
41 const fetchSvg = async () => {
42 try {
43 const response = await fetch(svgUrl);
44 const svgContent = await response.text();
45 setSvg(svgContent);
46 } catch (error) {
47 console.error("Error fetching SVG:", error);
48 }
49 };
50
51 fetchSvg();
52 }, [svgUrl]);
53

lastloginmain.tsx2 matches

@mrsnor•Updated 7 months ago
102 tokenUrl.searchParams.set("state", store.state);
103
104 const tokenResp = await fetch(tokenUrl.toString());
105 if (!tokenResp.ok) {
106 throw new Error(await tokenResp.text());
111 };
112
113 const resp = await fetch("https://lastlogin.io/userinfo", {
114 headers: {
115 Authorization: `Bearer ${access_token}`,

blob_adminmain.tsx2 matches

@ndyg•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));

proxyFetch2 file matches

@vidar•Updated 1 day ago

TAC_FetchBasic2 file matches

@A7_OMC•Updated 1 day ago