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=1273&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 16005 results for "fetch"(3787ms)

sqlite_adminmain.tsx1 match

@sitrucl•Updated 7 months ago
10app.get("/", async (c) => c.html(await sqlite_admin_tables()));
11app.get("/:table", async (c) => c.html(await sqlite_admin_table(c.req.param("table"))));
12export default basicAuth(app.fetch, { verifyUser: (_, password) => verifyToken(password) });

enchantingSilverPelicanmain.tsx4 matches

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

is_omnico_upmain.tsx2 matches

@lukebowerman•Updated 7 months ago
14 start = performance.now();
15 try {
16 const res = await fetch(url);
17 end = performance.now();
18 status = res.status;
25 } catch (e) {
26 end = performance.now();
27 reason = `couldn't fetch: ${e}`;
28 ok = false;
29 console.log(`Website down (${url}): ${reason} (${end - start}ms)`);

welcomingAmethystRaccoonmain.tsx4 matches

@carter_vargas•Updated 7 months ago
1// ... imports ...
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;

gnews2emailmain.tsx2 matches

@mforonda•Updated 7 months ago
16// --------------------------
17
18async function fetchNews(queries: any, hours: number, lang: string, region: string) {
19 let news;
20 let results = [];
103export default async function(interval: Interval) {
104 try {
105 const results = await fetchNews(queries, hours, lang, region);
106 console.log(`${
107 results.map(q => {

gnewsmain.tsx1 match

@joseforonda•Updated 7 months ago
41 { query, hours, lang, region }: { query: string; hours: number; lang: string; region: string },
42) {
43 const response = await fetch(
44 getFeedUrl(query, hours, lang, region),
45 );

brooklynWeatherFetchermain.tsx4 matches

@jjoak3•Updated 8 months ago
9
10 useEffect(() => {
11 async function fetchWeather() {
12 try {
13 // Los Angeles coordinates with Fahrenheit units
14 const response = await fetch(
15 "https://api.open-meteo.com/v1/forecast?latitude=34.0522&longitude=-118.2437&current=temperature_2m,relative_humidity_2m,wind_speed_10m,weather_code&temperature_unit=fahrenheit&wind_speed_unit=mph&timezone=America%2FLos_Angeles"
16 );
17
18 if (!response.ok) {
19 throw new Error('Weather data fetch failed');
20 }
21
29 }
30
31 fetchWeather();
32 }, []);
33

honoHTMLRendererValmain.tsx1 match

@stevedylandev•Updated 8 months ago
34
35
36export default app.fetch;

isMyWebsiteDownmain.tsx2 matches

@stevedave04•Updated 8 months ago
14 start = performance.now();
15 try {
16 const res = await fetch(url);
17 end = performance.now();
18 status = res.status;
25 } catch (e) {
26 end = performance.now();
27 reason = `couldn't fetch: ${e}`;
28 ok = false;
29 console.log(`Website down (${url}): ${reason} (${end - start}ms)`);

dns_record_debuggermain.tsx5 matches

@stevekrouse•Updated 8 months ago
9 const handleSubmit = async (e: React.FormEvent) => {
10 e.preventDefault();
11 const response = await fetch(`/proxy?url=${encodeURIComponent(url)}`);
12 const html = await response.text();
13 setContent(html);
19 <p>
20 It's difficult to check new DNS records, because old records may be cached on your computer, browser, or local
21 network. This tool uses <a href="https://docs.val.town/std/fetch" target="_blank">a proxied fetch</a>{" "}
22 so you can always view your web page uncached.
23 </p>
60
61export default async function server(request: Request): Promise<Response> {
62 const { fetch } = await import("https://esm.town/v/std/fetch");
63
64 const url = new URL(request.url);
71
72 try {
73 const proxyResponse = await fetch(targetUrl);
74 const content = await proxyResponse.text();
75 return new Response(content, {
77 });
78 } catch (error) {
79 return new Response("Error fetching the URL", { status: 500 });
80 }
81 }

manual-fetcher

@miz•Updated 1 week ago

fake-https1 file match

@blazemcworld•Updated 2 weeks ago
simple proxy to fetch http urls using https