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%20%22Image%20title%22?q=fetch&page=873&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 13280 results for "fetch"(4643ms)

wotdindex1 match

@wilhelm•Updated 3 months ago
68});
69
70export default app.fetch;

School_Management_Systemmain.tsx7 matches

@Alphydoo•Updated 3 months ago
25 const login = async (username, password, type) => {
26 try {
27 const response = await fetch('/login', {
28 method: 'POST',
29 headers: { 'Content-Type': 'application/json' },
46 const logout = async () => {
47 try {
48 await fetch('/logout', { method: 'POST' });
49 setUser(null);
50 setLoginType('');
115 const [classes, setClasses] = useState([]);
116
117 // Fetch initial data
118 useEffect(() => {
119 if (user) {
120 fetchData();
121 }
122 }, [user]);
123
124 const fetchData = async () => {
125 try {
126 const response = await fetch('/school-data');
127 const data = await response.json();
128 setStudents(data.students);
130 setClasses(data.classes);
131 } catch (error) {
132 console.error('Failed to fetch school data:', error);
133 }
134 };

jobboardmain.tsx11 matches

@user04•Updated 3 months ago
19 }
20
21 fetchJobs();
22 fetchMessages();
23 const interval = setInterval(() => {
24 fetchMessages();
25 }, 5000);
26 return () => clearInterval(interval);
27 }, []);
28
29 const fetchJobs = async () => {
30 const response = await fetch('/jobs');
31 const data = await response.json();
32 setJobs(data);
33 };
34
35 const fetchMessages = async () => {
36 const response = await fetch('/messages');
37 const data = await response.json();
38 setMessages(data);
41 const submitJob = async (e) => {
42 e.preventDefault();
43 await fetch('/jobs', {
44 method: 'POST',
45 headers: { 'Content-Type': 'application/json' },
47 });
48 setNewJob({ title: '', company: '', description: '' });
49 fetchJobs();
50 };
51
56 return;
57 }
58 await fetch('/messages', {
59 method: 'POST',
60 headers: { 'Content-Type': 'application/json' },
62 });
63 setNewMessage('');
64 fetchMessages();
65 };
66

wotdsign-up2 matches

@wilhelm•Updated 3 months ago
3async function servePublicFile(path: string): Promise<Response> {
4 const url = new URL("./public/" + path, import.meta.url);
5 const text = await (await fetch(url, {
6 headers: {
7 "User-Agent": "", // to transpile TS to JS
33
34 const url = new URL("./templates/index.html", import.meta.url);
35 const text = await (await fetch(url, {
36 headers: {
37 "User-Agent": "", // to transpile TS to JS

eloquentIvoryFishmain.tsx12 matches

@Marcyatieno•Updated 3 months ago
26 const handleSubmit = async (e) => {
27 e.preventDefault();
28 const response = await fetch("/post-job", {
29 method: "POST",
30 headers: { "Content-Type": "application/json" },
138 const [sortBy, setSortBy] = useState("newest");
139
140 const fetchJobs = async () => {
141 const response = await fetch("/get-jobs");
142 const data = await response.json();
143 setJobs(data);
144 };
145
146 const fetchSavedJobs = async () => {
147 const response = await fetch("/get-saved-jobs");
148 const data = await response.json();
149 setSavedJobs(data);
174
175 const saveJob = async (job) => {
176 const response = await fetch("/save-job", {
177 method: "POST",
178 headers: { "Content-Type": "application/json" },
180 });
181 if (response.ok) {
182 fetchSavedJobs();
183 }
184 };
185
186 const removeJob = async (jobId) => {
187 const response = await fetch(`/remove-saved-job/${jobId}`, {
188 method: "DELETE"
189 });
190 if (response.ok) {
191 fetchSavedJobs();
192 }
193 };
194
195 useEffect(() => {
196 fetchJobs();
197 fetchSavedJobs();
198 }, []);
199
235 </div>
236 <div className="job-listings">
237 <JobPostingForm onSubmit={fetchJobs} />
238 <h2>Current Job Postings</h2>
239 {filteredAndSortedJobs.length === 0 ? (

quaintWhiteBugmain.tsx4 matches

@Alphydoo•Updated 3 months ago
32
33 useEffect(() => {
34 async function fetchWeather() {
35 try {
36 setLoading(true);
37 const response = await fetch(
38 `https://api.open-meteo.com/v1/forecast?latitude=${location.latitude}&longitude=${location.longitude}&current_weather=true&hourly=temperature_2m,relative_humidity_2m,wind_speed_10m&daily=temperature_2m_max,temperature_2m_min,sunrise,sunset&timezone=auto`
39 );
42 setLoading(false);
43 } catch (error) {
44 console.error("Weather fetch error:", error);
45 setLoading(false);
46 }
47 }
48
49 fetchWeather();
50 }, [location]);
51

Document_Storage_Systemmain.tsx8 matches

@Alphydoo•Updated 3 months ago
22
23 useEffect(() => {
24 fetchDocuments();
25 }, []);
26
27 const fetchDocuments = async () => {
28 try {
29 const response = await fetch("/list-documents");
30 const docs = await response.json();
31 setDocuments(docs);
32 } catch (error) {
33 console.error("Failed to fetch documents:", error);
34 }
35 };
47
48 try {
49 const response = await fetch("/upload-document", {
50 method: "POST",
51 body: formData,
53
54 if (response.ok) {
55 fetchDocuments();
56 setSelectedFile(null);
57 event.target.reset();
64 const handleDelete = async (filename) => {
65 try {
66 const response = await fetch(`/delete-document?filename=${encodeURIComponent(filename)}`, {
67 method: "DELETE",
68 });
69
70 if (response.ok) {
71 fetchDocuments();
72 }
73 } catch (error) {

jobBoardAppmain.tsx10 matches

@edwinpr•Updated 3 months ago
10 const handleSubmit = async (e) => {
11 e.preventDefault();
12 const response = await fetch("/post-job", {
13 method: "POST",
14 headers: { "Content-Type": "application/json" },
53 const [jobs, setJobs] = useState([]);
54
55 const fetchJobs = async () => {
56 const response = await fetch("/get-jobs");
57 const data = await response.json();
58 setJobs(data);
60
61 useEffect(() => {
62 fetchJobs();
63 }, []);
64
83 const [newMessage, setNewMessage] = useState("");
84
85 const fetchMessages = async () => {
86 const response = await fetch("/get-messages");
87 const data = await response.json();
88 setMessages(data);
91 const sendMessage = async (e) => {
92 e.preventDefault();
93 const response = await fetch("/send-message", {
94 method: "POST",
95 headers: { "Content-Type": "application/json" },
98 if (response.ok) {
99 setNewMessage("");
100 fetchMessages();
101 }
102 };
103
104 useEffect(() => {
105 fetchMessages();
106 const interval = setInterval(fetchMessages, 5000);
107 return () => clearInterval(interval);
108 }, []);

fascinatingAmaranthStingraymain.tsx4 matches

@oke_oma•Updated 3 months ago
30
31 useEffect(() => {
32 fetchPeople();
33 }, [view]);
34
35 async function fetchPeople() {
36 try {
37 const response = await fetch(`/api/${view}`);
38 const data = await response.json();
39 setPeople(data);
40 } catch (error) {
41 console.error(`Error fetching ${view}:`, error);
42 }
43 }

sqliteExplorerAppmain.tsx4 matches

@alexwein•Updated 3 months ago
1/** @jsxImportSource npm:hono/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 })));

GithubPRFetcher

@andybak•Updated 14 hours ago

proxiedfetch1 file match

@jayden•Updated 1 day ago