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/$2?q=fetch&page=1028&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 13397 results for "fetch"(1428ms)

weatherDashboardmain.tsx4 matches

@oioioi•Updated 7 months ago
29
30 useEffect(() => {
31 fetchWeatherData(location);
32 }, [location]);
33
34 async function fetchWeatherData(city) {
35 try {
36 const response = await fetch(`${API_BASE_URL}?latitude=40.71&longitude=-74.01&daily=weathercode,temperature_2m_max,temperature_2m_min,precipitation_probability_max&current_weather=true&timezone=auto&forecast_days=7`);
37 const data = await response.json();
38 setWeatherData(data);
39 } catch (error) {
40 console.error("Error fetching weather data:", error);
41 }
42 }

dailySlackStandupmain.tsx2 matches

@dnishiyama•Updated 7 months ago
1import { fetch } from "https://esm.town/v/std/fetch";
2import { OpenAI } from "https://esm.town/v/std/openai";
3import process from "node:process";
55 const text = `Time for standup!\n${completion.choices[0].message.content}`;
56 // const text = `Time for standup!`;
57 // const res = await fetch(
58 // webhookUrl,
59 // {

simplifiedProjectPagemain.tsx1 match

@willthereader•Updated 7 months ago
22app.get("/projects/Debugging_Guide", Debugging_Guide);
23
24export default app.fetch;

generateframeImageREADME.md1 match

@stevekrouse•Updated 7 months ago
3### Why
4I'm using this val for my 3-color e-ink display run by a Raspberry Pi Zero W. The Pi runs a cron job that tell's it
5to fetch this url twice a day and render it to the display. Works like a charm.
6
7Right now I'm not displaying much but I'm going to keep iterating on what type of information I want to display.

generateframeImagemain.tsx4 matches

@stevekrouse•Updated 7 months ago
7 `https://api.open-meteo.com/v1/forecast?latitude=${latitude}&longitude=${longitude}&current_weather=true&temperature_unit=fahrenheit`;
8 try {
9 const response = await fetch(url);
10 if (!response.ok) {
11 throw new Error(`Weather API responded with status: ${response.status}`);
15 return data.current_weather;
16 } catch (error) {
17 console.error("Error fetching weather:", error);
18 return null;
19 }
135 </div>
136 )
137 : <div className="weather-info">Unable to fetch weather data</div>}
138 </div>
139 </body>
149
150 try {
151 const response = await fetch(url);
152 if (!response.ok) {
153 throw new Error(`APIFlash responded with status: ${response.status}`);

sqlitemain.tsx2 matches

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

neighborhoodOrderAppmain.tsx9 matches

@zlpkhr•Updated 7 months ago
11
12 useEffect(() => {
13 fetchProposals();
14 const signed = Cookies.get('signedProposals');
15 if (signed) {
18 }, []);
19
20 const fetchProposals = async () => {
21 const response = await fetch('/proposals');
22 const data = await response.json();
23 // Sort proposals by creation date (most recent first)
28 const handleSubmitProposal = async (e) => {
29 e.preventDefault();
30 await fetch('/proposals', {
31 method: 'POST',
32 headers: { 'Content-Type': 'application/json' },
34 });
35 setNewProposal({ title: '', proposer: '', targetCount: 10 });
36 fetchProposals();
37 };
38
46 return;
47 }
48 const response = await fetch(`/proposals/${id}/sign`, {
49 method: 'POST',
50 headers: { 'Content-Type': 'application/json' },
58 }
59 setSignature('');
60 fetchProposals();
61 };
62
63 const handleCancelSignature = async (id, name) => {
64 const response = await fetch(`/proposals/${id}/cancel`, {
65 method: 'POST',
66 headers: { 'Content-Type': 'application/json' },
72 setSignedProposals(newSignedProposals);
73 Cookies.set('signedProposals', JSON.stringify(Array.from(newSignedProposals)));
74 fetchProposals();
75 }
76 };

simpleWikipediaInstantSearchmain.tsx5 matches

@maxm•Updated 7 months ago
159 const query = searchInput.value.trim();
160 if (query.length > 0) {
161 fetchResults(query);
162 } else {
163 searchResults.style.display = 'none';
166 });
167
168 async function fetchResults(query) {
169 try {
170 const response = await fetch(\`/search?q=\${encodeURIComponent(query)}\`);
171 const results = await response.json();
172 displayResults(results);
173 } catch (error) {
174 console.error('Error fetching results:', error);
175 }
176 }
200`;
201
202export default app.fetch.bind(app);

singlePageUrlCheckermain.tsx11 matches

@willthereader•Updated 7 months ago
55}
56
57// Link Fetching Helper
58export class LinkFetcher {
59 static async fetchLinksFromWebsite(websiteUrl) {
60 console.log(`\nFetching links from website: ${websiteUrl}`);
61 const query = `
62 SELECT
72
73 console.log("Making LSD API request...");
74 const response = await fetch(
75 `https://lsd.so/api?query=${encodeURIComponent(query)}`,
76 );
77
78 if (!response.ok) {
79 console.log("Failed to fetch links from LSD API");
80 throw new Error("Failed to fetch links from website");
81 }
82
149 try {
150 console.log(`Attempting HEAD request for: ${url}`);
151 const response = await fetch(url, { method: "HEAD" });
152
153 if (!response.ok) {
154 console.log(`HEAD request failed, attempting GET request for: ${url}`);
155 const getResponse = await fetch(url, { method: "GET" });
156 return { ok: getResponse.ok, status: getResponse.status };
157 }
253 console.log(`Starting findBrokenLinks for website: ${websiteUrl}`);
254
255 // Fetch all links
256 const links = await LinkFetcher.fetchLinksFromWebsite(websiteUrl);
257
258 // Check links

valcoinDashboardmain.tsx8 matches

@aggy•Updated 7 months ago
14
15 useEffect(() => {
16 fetchWallets();
17 }, []);
18
19 async function fetchWallets() {
20 try {
21 const response = await fetch(`${API_URL}/wallets`);
22 const data = await response.json();
23 setWallets(data);
24 } catch (err) {
25 console.error("Error fetching wallets:", err);
26 setWallets([]);
27 setError("Failed to fetch wallets. Please try again later.");
28 }
29 }
31 async function createWallet() {
32 try {
33 const response = await fetch(`${API_URL}/create-wallet`, { method: "POST" });
34 const { key, hash } = await response.json();
35 const newWalletData = { key, hash, value: 0 };
67
68 try {
69 const response = await fetch(`${API_URL}/transfer`, {
70 method: "POST",
71 headers: { "Content-Type": "application/json" },
79 message: "Transfer successful!",
80 });
81 fetchWallets();
82 setSourceKey("");
83 setDestinationHash("");

GithubPRFetcher

@andybak•Updated 2 days ago

proxiedfetch1 file match

@jayden•Updated 2 days ago