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/image-url.jpg?q=fetch&page=155&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 10223 results for "fetch"(1157ms)

Townie-05requests.ts2 matches

@jxnblk•Updated 1 week ago
56 row.parentNode.insertBefore(newRow, row.nextSibling);
57
58 // Fetch the inference calls data
59 fetch('/api/inference-calls?usage_id=' + usageId)
60 .then(response => response.json())
61 .then(data => {

Townie-05project-files.ts2 matches

@jxnblk•Updated 1 week ago
30 return c.json({ files: files.data });
31 } catch (error) {
32 console.error("Error fetching project files:", error);
33 return Response.json({ error: "Failed to fetch project files" }, { status: 500 });
34 }
35});

Townie-05project-branches.ts2 matches

@jxnblk•Updated 1 week ago
21 return c.json({ branches: branches.data });
22 } catch (error) {
23 console.error("Error fetching branches:", error);
24 return Response.json({ error: "Failed to fetch branches" }, { status: 500 });
25 }
26});

Townie-05index.ts1 match

@jxnblk•Updated 1 week ago
21
22// This is the entry point for HTTP vals
23export default app.fetch;
24

Townie-05.cursorrules3 matches

@jxnblk•Updated 1 week ago
239
240 // Inject data to avoid extra round-trips
241 const initialData = await fetchInitialData();
242 const dataScript = `<script>
243 window.__INITIAL_DATA__ = ${JSON.stringify(initialData)};
286
2875. **API Design:**
288 - `fetch` handler is the entry point for HTTP vals
289 - Run the Hono app with `export default app.fetch // This is the entry point for HTTP vals`
290
291

esmTownTranspileDemo2main.tsx2 matches

@stevekrouse•Updated 1 week ago
1/** @jsxImportSource https://esm.sh/react */
2import { fetchText } from "https://esm.town/v/stevekrouse/fetchText";
3
4console.log(
5 await fetchText("https://esm.town/v/jxnblk/react-importmap-starter/client.tsx", {
6 headers: {
7 "User-Agent": "", // can't include Deno, which on Val Town it would by default

esmTownTranspileDemo2README.md1 match

@stevekrouse•Updated 1 week ago
5It doesn't do as much as other transpilers (such as esm.sh, such as rewriting `npm:` imports, etc). We may add that capability in the future. For now, if you want your npm imports to run in the browser, use `https://esm.sh/package` instead of `npm:package`.
6
7The below script demonstrates this transiplation behavior by fetching its own source code (`import.meta.url`) with the user agent of a browser. You can uncoment the line setting the browser agent if you want to see the difference in the output. Or you could just load this val's module URL in your browser to see the untranspiled TS.
8
9As of July 23, 2024, this is the code that determines when esm.town transpiles or not:

MUSALLapp.js10 matches

@otega07•Updated 1 week ago
45 // User-related API calls
46 async createUser(userData) {
47 const response = await fetch('/api/users', {
48 method: 'POST',
49 headers: { 'Content-Type': 'application/json' },
60
61 async getUser(userId) {
62 const response = await fetch(`/api/users/${userId}`);
63
64 const data = await response.json();
71
72 async updateUser(userId, userData) {
73 const response = await fetch(`/api/users/${userId}`, {
74 method: 'PATCH',
75 headers: { 'Content-Type': 'application/json' },
87 // Playlist-related API calls
88 async getUserPlaylists(userId) {
89 const response = await fetch(`/api/playlists/user/${userId}`);
90
91 const data = await response.json();
104 }
105
106 const response = await fetch(url);
107
108 const data = await response.json();
116 // Session-related API calls
117 async getUserSessions(userId) {
118 const response = await fetch(`/api/sessions/user/${userId}`);
119
120 const data = await response.json();
127
128 async getSession(sessionId) {
129 const response = await fetch(`/api/sessions/${sessionId}`);
130
131 const data = await response.json();
139 // AI recommendation API calls
140 async generatePlaylist(userId, request) {
141 const response = await fetch('/api/recommendations/playlist', {
142 method: 'POST',
143 headers: { 'Content-Type': 'application/json' },
154
155 async generateDrills(userId, request) {
156 const response = await fetch('/api/recommendations/drills', {
157 method: 'POST',
158 headers: { 'Content-Type': 'application/json' },
169
170 async generateSession(userId, request) {
171 const response = await fetch('/api/recommendations/session', {
172 method: 'POST',
173 headers: { 'Content-Type': 'application/json' },

gordwameindex.ts2 matches

@alexwein•Updated 1 week ago
141});
142
143// HTTP vals expect an exported "fetch handler"
144// This is how you "run the server" in Val Town with Hono
145export default app.fetch;

gordwameApp.tsx2 matches

@alexwein•Updated 1 week ago
47
48 useEffect(() => {
49 // Only fetch a new board if we don't have an initial board
50 if (!initialBoard) {
51 async function initializeBoard() {
52 setIsLoading(true);
53 try {
54 const response = await fetch("/newBoard");
55 const data = await response.json();
56

agentplex-deal-flow-email-fetch1 file match

@anandvc•Updated 4 days ago

proxyFetch2 file matches

@vidar•Updated 6 days ago