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/$1?q=fetch&page=1008&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 15664 results for "fetch"(8421ms)

Cardvaluemain.tsx2 matches

@find•Updated 3 months ago
85 }
86
87 const response = await fetch("/grade-card", {
88 method: "POST",
89 headers: { "Content-Type": "application/json" },
274
275 if (request.method === "OPTIONS") {
276 // Handle CORS preflight requests if needed (though likely not necessary for same-origin val fetches)
277 return new Response(null, { headers: { "Allow": "POST, OPTIONS" } });
278 }

Learningmain.tsx9 matches

@find•Updated 3 months ago
25 leaderboard: [], // Stores top scores for the current topic, e.g., [90, 85, 80]
26 stage: "topic-selection", // 'topic-selection', 'study', 'quiz', 'results'
27 loadingMessage: null, // e.g., "Fetching study material..."
28 error: null, // Stores error messages for display
29 });
36 // --- API Interaction Functions ---
37
38 const fetchStudyMaterial = useCallback(async (topic) => {
39 setLoading(`Generating study material for "${topic}"...`);
40 try {
41 const response = await fetch("/generate-study-material", {
42 method: "POST",
43 headers: { "Content-Type": "application/json" },
59 }));
60 } catch (error) {
61 console.error("Error fetching study material:", error);
62 setError(`Failed to generate study material: ${error.message}`);
63 // Optionally revert stage if needed
70 setLoading(`Generating quiz for "${state.selectedTopic}"...`);
71 try {
72 const response = await fetch("/generate-quiz", {
73 method: "POST",
74 headers: { "Content-Type": "application/json" },
136
137 // Submit to backend for leaderboard update
138 const response = await fetch("/submit-quiz-results", {
139 method: "POST",
140 headers: { "Content-Type": "application/json" },
179 const handleTopicSelect = (topic) => {
180 if (state.loadingMessage) return; // Prevent action while loading
181 // No need to set selectedTopic here, fetchStudyMaterial does it on success
182 fetchStudyMaterial(topic);
183 };
184
539 });
540
541 // Fetch leaderboard (Top 10 distinct scores for this topic)
542 const leaderboardResults = await sqlite.execute({
543 sql: `SELECT DISTINCT score FROM ${RESULTS_TABLE} WHERE topic = ? ORDER BY score DESC LIMIT 10`,

homerepairmain.tsx1 match

@Learn•Updated 3 months ago
231
232 try {
233 const response = await fetch("/execute-command", {
234 method: "POST",
235 headers: { "Content-Type": "application/json" },

email_capture_system_2App.tsx11 matches

@prashamtrivedi•Updated 3 months ago
19 const [activeTab, setActiveTab] = useState('projects');
20
21 // Fetch initial data
22 useEffect(() => {
23 const fetchData = async () => {
24 try {
25 setLoading(true);
26
27 // Fetch projects
28 const projectsRes = await fetch(`${API_BASE_URL}/projects`);
29 const projectsData = await projectsRes.json();
30
35 setProjects(projectsData.data || []);
36
37 // Fetch subscribers
38 const subscribersRes = await fetch(`${API_BASE_URL}/subscribers`);
39 const subscribersData = await subscribersRes.json();
40
46
47 } catch (err) {
48 console.error('Error fetching data:', err);
49 setError(err.message);
50 } finally {
53 };
54
55 fetchData();
56 }, []);
57
61 setLoading(true);
62
63 const response = await fetch(`${API_BASE_URL}/projects`, {
64 method: 'POST',
65 headers: {
90 const updateProject = async (id, updates) => {
91 try {
92 const response = await fetch(`${API_BASE_URL}/projects/${id}`, {
93 method: 'PATCH',
94 headers: {
128 const getProjectSubscribers = async (projectId) => {
129 try {
130 const response = await fetch(`${API_BASE_URL}/projects/${projectId}/subscribers`);
131 const data = await response.json();
132

email_capture_system_2routes.ts1 match

@prashamtrivedi•Updated 3 months ago
285});
286
287export default api.fetch;

email_capture_system_2index.ts1 match

@prashamtrivedi•Updated 3 months ago
54});
55
56export default app.fetch;
57

photosmain.tsx2 matches

@Learn•Updated 3 months ago
32 // Initialize with demo data
33 useEffect(() => {
34 // Simulate API fetch
35 setLoading(true);
36 setTimeout(() => {
250 // View user profile
251 const viewProfile = (userId) => {
252 // In a real app, fetch the user profile
253 // For demo, use current user's profile if it's their profile
254 if (userId === currentUser.id) {

dailySlackRoundupmain.tsx2 matches

@devbratpandey•Updated 3 months ago
1import { fetch } from "https://esm.town/v/std/fetch";
2import { getDayName } from "https://esm.town/v/stevekrouse/getDayName?v=2";
3import process from "node:process";
4
5export const dailySlackRoundup = (async () => {
6 const res = await fetch(process.env.BRAINBOT_WEBHOOK_URL, {
7 method: "POST",
8 body: JSON.stringify({

tangledRSSmain.tsx7 matches

@hrbrmstr•Updated 3 months ago
9 try {
10 // Resolve handle to DID
11 const handleResolveResponse = await fetch(
12 `https://bsky.social/xrpc/com.atproto.identity.resolveHandle?handle=${handle}`,
13 );
14 const { did } = await handleResolveResponse.json();
15
16 // Fetch DID document
17 const didDocResponse = await fetch(`https://plc.directory/${did}`);
18 const didDoc = await didDocResponse.json();
19 const serviceEndpoint = didDoc.service[0].serviceEndpoint;
20
21 // Fetch all records
22 const allRecords = await fetchAllRecords(serviceEndpoint, did);
23
24 // Generate RSS feed
35}
36
37async function fetchAllRecords(serviceEndpoint: string, did: string): Promise<any[]> {
38 const allRecords: any[] = [];
39 let cursor = "";
46 if (cursor) url.searchParams.set("cursor", cursor);
47
48 const response = await fetch(url.toString());
49 const data = await response.json();
50

FixItWandusers.ts1 match

@wolf•Updated 3 months ago
38 .where(eq(usersTable.id, id));
39
40 // Fetch and return the updated user
41 return getUserById(id);
42}

manual-fetcher

@miz•Updated 3 days ago

fake-https1 file match

@blazemcworld•Updated 1 week ago
simple proxy to fetch http urls using https