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=439&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 8952 results for "fetch"(1806ms)

chatAppmain.tsx1 match

@luka•Updated 2 months ago
94
95 try {
96 const response = await fetch('/reset-password', {
97 method: 'POST',
98 headers: { 'Content-Type': 'application/json' },

soapStoreTemplatemain.tsx18 matches

@NathChrisTiwi•Updated 2 months ago
96
97 useEffect(() => {
98 fetchProducts();
99 fetchCompanyInfo();
100 fetchRecommendations();
101 fetchChatMessages();
102 }, []);
103
104 const fetchProducts = async () => {
105 try {
106 const response = await fetch('/products');
107 const data = await response.json();
108 setProducts(data);
109 } catch (error) {
110 console.error('Failed to fetch products', error);
111 }
112 };
113
114 const fetchCompanyInfo = async () => {
115 try {
116 const response = await fetch('/company-info');
117 const data = await response.json();
118 setCompanyInfo(data);
119 } catch (error) {
120 console.error('Failed to fetch company info', error);
121 }
122 };
123
124 const fetchRecommendations = async () => {
125 try {
126 const response = await fetch('/recommendations');
127 const data = await response.json();
128 setRecommendations(data);
129 } catch (error) {
130 console.error('Failed to fetch recommendations', error);
131 }
132 };
133
134 const fetchChatMessages = async () => {
135 try {
136 const response = await fetch('/chat-messages');
137 const data = await response.json();
138 setChatMessages(data);
139 } catch (error) {
140 console.error('Failed to fetch chat messages', error);
141 }
142 };
175
176 try {
177 await fetch('/send-chat', {
178 method: 'POST',
179 headers: { 'Content-Type': 'application/json' },
185 });
186 setNewMessage('');
187 fetchChatMessages();
188 } catch (error) {
189 console.error('Failed to send chat message', error);

lovingCoralTapirmain.tsx10 matches

@khennyyb•Updated 2 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
113 const [username, setUsername] = useState(localStorage.getItem('chatUsername') || "");
114
115 const fetchMessages = async () => {
116 const response = await fetch("/get-messages");
117 const data = await response.json();
118 setMessages(data);
121 const sendMessage = async (e) => {
122 e.preventDefault();
123 const response = await fetch("/send-message", {
124 method: "POST",
125 headers: { "Content-Type": "application/json" },
131 if (response.ok) {
132 setNewMessage("");
133 fetchMessages();
134 }
135 };
136
137 useEffect(() => {
138 fetchMessages();
139 const interval = setInterval(fetchMessages, 5000);
140 return () => clearInterval(interval);
141 }, []);

sqlitemain.tsx2 matches

@Sm202020•Updated 2 months ago
35
36async function execute(statement: InStatement): Promise<ResultSet> {
37 const res = await fetch(`${API_URL}/v1/sqlite/execute`, {
38 method: "POST",
39 headers: {
49
50async function batch(statements: InStatement[], mode?: TransactionMode): Promise<ResultSet[]> {
51 const res = await fetch(`${API_URL}/v1/sqlite/batch`, {
52 method: "POST",
53 headers: {

jobChatAppmain.tsx10 matches

@khennyyb•Updated 2 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
113 const [username, setUsername] = useState(localStorage.getItem('chatUsername') || "");
114
115 const fetchMessages = async () => {
116 const response = await fetch("/get-messages");
117 const data = await response.json();
118 setMessages(data);
121 const sendMessage = async (e) => {
122 e.preventDefault();
123 const response = await fetch("/send-message", {
124 method: "POST",
125 headers: { "Content-Type": "application/json" },
131 if (response.ok) {
132 setNewMessage("");
133 fetchMessages();
134 }
135 };
136
137 useEffect(() => {
138 fetchMessages();
139 const interval = setInterval(fetchMessages, 5000);
140 return () => clearInterval(interval);
141 }, []);

harmoniousMaroonFlyingfishmain.tsx4 matches

@Sm202020•Updated 2 months ago
45 e.preventDefault();
46 try {
47 const response = await fetch("/login", {
48 method: "POST",
49 headers: { "Content-Type": "application/json" },
67 e.preventDefault();
68 try {
69 const response = await fetch("/transfer", {
70 method: "POST",
71 headers: { "Content-Type": "application/json" },
114
115 try {
116 const response = await fetch("/signup", {
117 method: "POST",
118 headers: { "Content-Type": "application/json" },
533 `, [sender.account_number, recipient.account_number, amount]);
534
535 // Fetch updated sender account details
536 const updatedSenderResult = await sqlite.execute(
537 `SELECT * FROM ${KEY}_users_${SCHEMA_VERSION} WHERE account_number = ?`,

wotdindex1 match

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

School_Management_Systemmain.tsx7 matches

@Alphydoo•Updated 2 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 2 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 2 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

fetchPaginatedData2 file matches

@nbbaier•Updated 3 weeks ago

FetchBasic1 file match

@fredmoon•Updated 3 weeks ago