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=617&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 9397 results for "fetch"(2629ms)

effortlessAquamarineHookwormmain.tsx14 matches

@nsafouane•Updated 6 months ago
110}
111
112function Dashboard({ postCount, totalViews, posts, fetchDashboardStats }) {
113 const [title, setTitle] = useState("");
114 const [content, setContent] = useState("");
119
120 const handleApiKeySave = async () => {
121 const response = await fetch('/save-api-key', {
122 method: 'POST',
123 headers: { 'Content-Type': 'application/json' },
133 setIsGenerating(true);
134 try {
135 const response = await fetch('/generate-post', {
136 method: 'POST',
137 headers: { 'Content-Type': 'application/json' },
151 const handleSubmit = async (e) => {
152 e.preventDefault();
153 const response = await fetch('/create-post', {
154 method: 'POST',
155 headers: { 'Content-Type': 'application/json' },
157 });
158 const newPost = await response.json();
159 fetchDashboardStats();
160 setTitle("");
161 setContent("");
275
276 useEffect(() => {
277 fetchPosts(pageNumber);
278 fetchDashboardStats();
279 }, [pageNumber]);
280
290 };
291
292 const fetchPosts = async (page) => {
293 const response = await fetch(`/posts?page=${page}`);
294 const data = await response.json();
295 setPosts(data.posts);
297 };
298
299 const fetchDashboardStats = async () => {
300 const response = await fetch('/dashboard');
301 const stats = await response.json();
302 setDashboard(stats);
326 totalViews={dashboard.totalViews}
327 posts={posts}
328 fetchDashboardStats={fetchDashboardStats}
329 />
330 )}
401 const { topic } = await request.json();
402
403 // Fetch stored API key
404 const apiKeyResult = await sqlite.execute(
405 `SELECT api_key FROM ${KEY}_api_keys_${SCHEMA_VERSION} WHERE service = ?`,
414
415 try {
416 const response = await fetch('https://generativelanguage.googleapis.com/v1beta/models/gemini-pro:generateContent', {
417 method: 'POST',
418 headers: {

multilingualchatroommain.tsx21 matches

@lloydpearsoniv•Updated 6 months ago
195 useEffect(() => {
196 if (roomId) {
197 const fetchDefaultUsername = async () => {
198 try {
199 // First, check if there's a username in localStorage
202 setUsername(storedUsername);
203 } else {
204 // If not, fetch a default username from the server
205 const response = await fetch(`/default-username?room=${roomId}`);
206 if (response.ok) {
207 const defaultUsername = await response.text();
218 }
219 } catch (error) {
220 console.error("Error fetching default username:", error);
221 }
222 };
223
224 fetchDefaultUsername();
225 }
226 }, [roomId]);
230 const pollMessages = async () => {
231 try {
232 const response = await fetch(`/messages?room=${roomId}&language=${language}`);
233 if (response.ok) {
234 const newMessages = await response.json();
242 }
243 } catch (error) {
244 console.error("Error fetching messages:", error);
245 }
246 };
247
248 const fetchUsers = async () => {
249 try {
250 const response = await fetch(`/users?room=${roomId}`);
251 if (response.ok) {
252 const userList = await response.json();
254 }
255 } catch (error) {
256 console.error("Error fetching users:", error);
257 }
258 };
259
260 const fetchTypingUsers = async () => {
261 try {
262 const response = await fetch(`/typing-users?room=${roomId}`);
263 if (response.ok) {
264 const typingUsersList = await response.json();
266 }
267 } catch (error) {
268 console.error("Error fetching typing users:", error);
269 }
270 };
271
272 pollMessages();
273 fetchUsers();
274 fetchTypingUsers();
275 const messageIntervalId = setInterval(pollMessages, 2000);
276 const userIntervalId = setInterval(fetchUsers, 5000);
277 const typingIntervalId = setInterval(fetchTypingUsers, 1000);
278
279 return () => {
289 if (language !== "en") {
290 try {
291 const translatedMessage = await fetch("/translate-text", {
292 method: "POST",
293 headers: { "Content-Type": "application/json" },
315 if (inputMessage && roomId && username) {
316 try {
317 const response = await fetch("/send-message", {
318 method: "POST",
319 headers: { "Content-Type": "application/json" },
346 } else {
347 try {
348 const response = await fetch("/update-user", {
349 method: "POST",
350 headers: { "Content-Type": "application/json" },
403 if (roomId && username) {
404 try {
405 await fetch("/update-typing", {
406 method: "POST",
407 headers: { "Content-Type": "application/json" },

scraper_templatemain.tsx1 match

@lloydpearsoniv•Updated 6 months ago
9 const variable: string = await blob.getJSON(blobKey) ?? "";
10
11 const response = await fetch(scrapeURL);
12 const body = await response.text();
13 const $ = cheerio.load(body);

blob_adminmain.tsx2 matches

@lloydpearsoniv•Updated 6 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));

pjsSearchUImain.tsx1 match

@g•Updated 6 months ago
202app.get('/favicon.svg', serve(favicon, 'image/svg+xml'));
203
204export default app.fetch;

HermesTresmegistusmain.tsx2 matches

@jidun•Updated 6 months ago
248
249 try {
250 const response = await fetch('/chat', {
251 method: 'POST',
252 headers: {
312});
313
314export default app.fetch;

cerebras_codermain.tsx1 match

@kxxoling•Updated 6 months ago
23
24 try {
25 const response = await fetch("/", {
26 method: "POST",
27 body: JSON.stringify({ prompt, currentCode: code }),

webpage_summarizermain.tsx3 matches

@ubixsnow•Updated 6 months ago
14
15 try {
16 const response = await fetch("/summarize", {
17 method: "POST",
18 body: JSON.stringify({ url }),
100 const { url } = await request.json();
101
102 // Fetch webpage content
103 const webpageResponse = await fetch(url);
104 const webpageText = await webpageResponse.text();
105

mightyAmberAlbatrossmain.tsx4 matches

@anniewong25•Updated 6 months ago
1import { email } from "https://esm.town/v/std/email?v=9";
2
3// Fetches a random joke.
4async function fetchRandomJoke() {
5 const response = await fetch(
6 "https://official-joke-api.appspot.com/random_joke",
7 );
9}
10
11const randomJoke = await fetchRandomJoke();
12const setup = randomJoke.setup;
13const punchline = randomJoke.punchline;

dailyDadJokemain.tsx2 matches

@theswiftcoder•Updated 6 months ago
1import { email } from "https://esm.town/v/std/email";
2import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON";
3
4export async function dailyDadJoke() {
5 let { setup, punchline } = await fetchJSON("https://official-joke-api.appspot.com/random_joke");
6 return email({
7 text: punchline,

proxyFetch2 file matches

@vidar•Updated 2 days ago

TAC_FetchBasic2 file matches

@A7_OMC•Updated 2 days ago