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=430&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 8410 results for "fetch"(1182ms)

twitterAlertmain.tsx1 match

@charmainetest•Updated 3 months ago
19 : Math.floor((Date.now() - 2 * 24 * 60 * 60 * 1000) / 1000);
20
21 // Fetch and log tweets
22 const response = await socialDataSearch(`${query} since_time:${timeFrame}`);
23 console.log("Response from socialDataSearch:", response);

cerebras_codermain.tsx1 match

@vishu44•Updated 3 months ago
182
183 try {
184 const response = await fetch("/", {
185 method: "POST",
186 body: JSON.stringify({

tactfulCoffeeOctopusmain.tsx1 match

@charmaine•Updated 3 months ago
19 : Math.floor((Date.now() - 2 * 24 * 60 * 60 * 1000) / 1000);
20
21 // Fetch and log tweets
22 const response = await socialDataSearch(`${query} since_time:${timeFrame}`);
23 console.log("Response from socialDataSearch:", response);

ReactStaticmain.tsx1 match

@jxnblk•Updated 3 months ago
6
7export type RequestHandler = (request: Request) => Promise<Response>;
8export type DataFetcher<T> = (request: Request) => Promise<T>;
9
10// export type DataRequest<T> = Request & { data: T };

ReactStaticREADME.md2 matches

@jxnblk•Updated 3 months ago
66```
67
68### Fetch data on the server to set initial props
69
70
72// example middleware
73async function getInitialProps (req: Request, res: Response, next) {
74 // fetch data or do async work to pass as props to the component
75 req.data = {
76 hello: "props",

ReactStream_migratedmain.tsx4 matches

@jxnblk•Updated 3 months ago
6
7export type RequestHandler = (request: Request) => Promise<Response>;
8export type DataFetcher<T> = (request: Request) => Promise<T>;
9
10// export type DataRequest<T> = Request & { data: T };
132 return api(req);
133};
134const deprecatedGetInitiaProps = (getProps: DataFetcher<any>): Middleware => async (req, res, next) => {
135 if (!getProps) return next();
136 const data = await getProps(req);
144 /** DEPRECATED: Optional API request handler for all non-GET methods */
145 api?: RequestHandler;
146 /** DEPRECATED: data fetcher to set initial props based on request */
147 getInitialProps?: DataFetcher<any>;
148}

myBookmarkManagermain.tsx11 matches

@arfan•Updated 3 months ago
87 // ----------------- Effects -----------------
88 useEffect(() => {
89 fetchSavedBookmarks();
90 }, []);
91
180
181 // ----------------- Data Loading -----------------
182 async function fetchSavedBookmarks() {
183 const response = await fetch("/api/bookmarks");
184 const data = await response.json();
185 setAllSavedBookmarks(data);
232 e.preventDefault();
233 if (editBookmarkId === null) {
234 const response = await fetch("/api/bookmarks", {
235 method: "POST",
236 headers: { "Content-Type": "application/json" },
248 if (response.ok) {
249 closeAddBookmarkOverlay();
250 fetchSavedBookmarks();
251 }
252 } else {
253 const response = await fetch(`/api/bookmarks/${editBookmarkId}`, {
254 method: "PUT",
255 headers: { "Content-Type": "application/json" },
267 if (response.ok) {
268 closeAddBookmarkOverlay();
269 fetchSavedBookmarks();
270 }
271 }
274 // ----------------- Export / Import -----------------
275 async function saveAllBookmarks() {
276 const response = await fetch("/api/bookmarks/export");
277 const bookmarkData = await response.text(); // Get as text instead of blob
278 const blob = new Blob([bookmarkData], { type: "application/json" });
297 try {
298 const loadedBookmarks = JSON.parse(fileContent);
299 const response = await fetch("/api/bookmarks/import", {
300 method: "POST",
301 headers: { "Content-Type": "application/json" },
304 if (response.ok) {
305 alert("Bookmarks loaded successfully");
306 fetchSavedBookmarks();
307 } else {
308 alert("Error loading bookmarks");
1513
1514export default async function handleRequest(request) {
1515 return app.fetch(request);
1516}
1517

twitterAlertmain.tsx1 match

@ben5mills5•Updated 3 months ago
20 : Math.floor((Date.now() - 2 * 24 * 60 * 60 * 1000) / 1000);
21
22 // Fetch and log tweets
23 const response = await socialDataSearch(`${query} since_time:${timeFrame}`);
24 console.log("Response from socialDataSearch:", response);

chatApplicationmain.tsx18 matches

@Shigigami•Updated 3 months ago
30
31 try {
32 const response = await fetch(`/${mode}`, {
33 method: "POST",
34 headers: { "Content-Type": "application/json" },
41 setIsLoggedIn(true);
42 setError("");
43 await fetchContacts();
44 await fetchMessages();
45 await fetchFiles();
46 } else {
47 setError(data.message || "Authentication failed");
53 };
54
55 const fetchContacts = async () => {
56 try {
57 const response = await fetch("/contacts");
58 if (response.ok) {
59 const data = await response.json();
64 }
65 } catch (error) {
66 console.error("Failed to fetch contacts", error);
67 }
68 };
69
70 const fetchMessages = async () => {
71 try {
72 const response = await fetch("/messages");
73 if (response.ok) {
74 const data = await response.json();
76 }
77 } catch (error) {
78 console.error("Failed to fetch messages", error);
79 }
80 };
81
82 const fetchFiles = async () => {
83 try {
84 const response = await fetch("/files");
85 if (response.ok) {
86 const data = await response.json();
88 }
89 } catch (error) {
90 console.error("Failed to fetch files", error);
91 }
92 };
97
98 try {
99 const response = await fetch("/message", {
100 method: "POST",
101 headers: { "Content-Type": "application/json" },
109 if (response.ok) {
110 setNewMessage("");
111 await fetchMessages();
112 }
113 } catch (error) {
141
142 try {
143 const response = await fetch("/upload", {
144 method: "POST",
145 body: formData
147
148 if (response.ok) {
149 await fetchFiles();
150 fileInputRef.current.value = null;
151 }
157 const downloadFile = async (fileId) => {
158 try {
159 const response = await fetch(`/download/${fileId}`);
160 if (response.ok) {
161 const blob = await response.blob();

umbrellaRemindermain.tsx2 matches

@samjb123•Updated 3 months ago
1import { email } from "https://esm.town/v/std/email?v=9";
2import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON";
3import { nominatimSearch } from "https://esm.town/v/stevekrouse/nominatimSearch";
4import { weatherGovGrid } from "https://esm.town/v/stevekrouse/weatherGovGrid";
14 lon,
15 });
16 let { properties: { periods } } = await fetchJSON(
17 grid.forecastHourly,
18 );

fetchPaginatedData2 file matches

@nbbaier•Updated 2 weeks ago

FetchBasic1 file match

@fredmoon•Updated 2 weeks ago