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=1058&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 13101 results for "fetch"(1388ms)

extractTextmain.tsx2 matches

@ttodosi•Updated 9 months ago
1import { fetch } from "https://esm.town/v/std/fetch";
2
3export async function extractText(data, name) {
4 const fileUrl =
5 "https://www.gcmgrosvenor.com/wp-content/uploads/Private-Credit-Co-investing-GCM-Grosvenor.pdf";
6 const blob = await fetch(fileUrl).then((r) => r.blob());
7 const pdfjs = await import("npm:pdfjs-dist"); //https://www.npmjs.com/package/pdf-to-text
8 return Object.keys(pdfjs);

smsjournalerregistrationmain.tsx2 matches

@cephalization•Updated 9 months ago
14 try {
15 const sanitizedPhoneNumber = phoneNumber.replace(/\D/g, "");
16 const response = await fetch("/submit", {
17 method: "POST",
18 headers: { "Content-Type": "application/json" },
75 // submit to relayUrl/register as a post with phone in json body
76 // use shared secret as bearer auth
77 const response = await fetch(relayURL + "/register", {
78 method: "POST",
79 headers: {

npmExplorermain.tsx9 matches

@all•Updated 9 months ago
2 * This val creates an enhanced NPM package explorer using the npm registry API.
3 * It displays a grid of npm packages with basic information, categories, and navigation.
4 * The approach uses React for the frontend and fetch for API calls.
5 * It includes a details view for each package, a link to the npm page, and category navigation.
6 * Icons are added for each category, and additional pill boxes are included for specific topics.
106 const [loading, setLoading] = useState(false);
107
108 const fetchPackages = useCallback(async () => {
109 setLoading(true);
110 let url = `/search?q=${encodeURIComponent(searchTerm)}&size=${ITEMS_PER_PAGE}&from=${(page - 1) * ITEMS_PER_PAGE}`;
113 }
114 try {
115 const response = await fetch(url);
116 const data = await response.json();
117 setPackages(data.objects || []);
118 } catch (error) {
119 console.error("Error fetching packages:", error);
120 setPackages([]);
121 } finally {
125
126 useEffect(() => {
127 fetchPackages();
128 }, [fetchPackages]);
129
130 const handleSearch = (e) => {
131 e.preventDefault();
132 setPage(1);
133 fetchPackages();
134 };
135
289
290 try {
291 const response = await fetch(apiUrl);
292 const data = await response.json();
293 return new Response(JSON.stringify(data), {
295 });
296 } catch (error) {
297 console.error("Error fetching from npm registry:", error);
298 return new Response(JSON.stringify({ objects: [] }), {
299 status: 500,

lastlogin_demomain.tsx1 match

@tionis•Updated 9 months ago
25});
26
27export default lastlogin(app.fetch);

lastloginREADME.md1 match

@tionis•Updated 9 months ago
38});
39
40export default lastlogin(app.fetch);
41```

lastloginmain.tsx2 matches

@tionis•Updated 9 months ago
95 tokenUrl.searchParams.set("state", store.state);
96
97 const tokenResp = await fetch(tokenUrl.toString());
98 if (!tokenResp.ok) {
99 throw new Error(await tokenResp.text());
104 };
105
106 const resp = await fetch("https://lastlogin.io/userinfo", {
107 headers: {
108 Authorization: `Bearer ${access_token}`,

sqliteExplorerAppmain.tsx4 matches

@rizoadev•Updated 9 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 })));

test_migratedmain.tsx1 match

@jxnblk•Updated 9 months ago
76 if (valURL) {
77 try {
78 await fetch(valURL)
79 .then(res => res.json())
80 .then(res => {

textStoragemain.tsx26 matches

@all•Updated 9 months ago
51
52 useEffect(() => {
53 fetchTexts();
54 fetchTemplates();
55 fetchCategories();
56 fetchHistory();
57 }, []);
58
59 const fetchTexts = async () => {
60 const response = await fetch('/texts');
61 const data = await response.json();
62 setTexts(data);
63 };
64
65 const fetchTemplates = async () => {
66 const response = await fetch('/templates');
67 const data = await response.json();
68 setTemplates(data);
69 };
70
71 const fetchCategories = async () => {
72 const response = await fetch('/categories');
73 const data = await response.json();
74 setCategories(data);
75 };
76
77 const fetchHistory = async () => {
78 const response = await fetch('/history');
79 const data = await response.json();
80 setHistory(data);
95 const method = editingText && editingText.id !== 0 ? 'PUT' : 'POST';
96
97 const response = await fetch(url, {
98 method,
99 headers: { 'Content-Type': 'application/json' },
102
103 if (response.ok) {
104 fetchTexts();
105 fetchCategories();
106 fetchHistory();
107 setModalOpen(false);
108 setEditingText(null);
124 const method = 'PUT';
125
126 const response = await fetch(url, {
127 method,
128 headers: { 'Content-Type': 'application/json' },
131
132 if (response.ok) {
133 fetchTemplates();
134 setModalOpen(false);
135 setEditingTemplate(null);
139
140 const deleteText = async (id: number) => {
141 const response = await fetch(`/texts/${id}`, { method: 'DELETE' });
142 if (response.ok) {
143 fetchTexts();
144 fetchCategories();
145 fetchHistory();
146 }
147 };
155 };
156
157 const response = await fetch('/texts', {
158 method: 'POST',
159 headers: { 'Content-Type': 'application/json' },
162
163 if (response.ok) {
164 fetchTexts();
165 fetchCategories();
166 fetchHistory();
167 setActiveTab("texts");
168 }

memeGeneratormain.tsx1 match

@stevekrouse•Updated 9 months ago
30
31 useEffect(() => {
32 fetch("/templates")
33 .then(response => response.json())
34 .then(data => setTemplates(data));

fetch-socials4 file matches

@welson•Updated 3 days ago
fetch and archive my social posts

fetchRssForSubcurrent2 file matches

@ashryanio•Updated 3 days ago