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%22Optional%20title%22?q=fetch&page=748&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 10861 results for "fetch"(1044ms)

constantTomatoTarantulamain.tsx3 matches

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

CS1200Projmain.tsx5 matches

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

readablemain.tsx1 match

@neverstew•Updated 6 months ago
3
4export default async function(req: Request) {
5 let resp = await fetch(`https://${new URL(req.url).pathname.replace(/^https?:\/\//, '')}`, req);
6 let body = await resp.text();
7 let doc = new JSDOM(body);

uptimemain.tsx7 matches

@vyatka•Updated 6 months ago
10 const start = performance.now();
11 try {
12 const res = await fetch(url, {
13 method: 'GET',
14 headers: { 'User-Agent': 'ValTown Uptime Checker' }
24 } catch (e) {
25 end = performance.now();
26 reason = `couldn't fetch: ${e}`;
27 ok = false;
28 console.log(`Website down (${url}): ${reason} (${end - start}ms)`);
51
52 useEffect(() => {
53 async function fetchUptimeData() {
54 try {
55 const response = await fetch('/uptime-data');
56 const data = await response.json();
57 setUptimeData(data);
58 setLoading(false);
59 } catch (error) {
60 console.error('Failed to fetch uptime data:', error);
61 setLoading(false);
62 }
63 }
64 fetchUptimeData();
65 const interval = setInterval(fetchUptimeData, 60000); // Refresh every minute
66 return () => clearInterval(interval);
67 }, []);

iheartjankboteko1main.tsx4 matches

@iheartjankboteko•Updated 6 months ago
1import { email } from "https://esm.town/v/std/email?v=9";
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;

Jokemain.tsx4 matches

@slothfuldreams•Updated 6 months ago
1import { email } from "https://esm.town/v/std/email?v=9";
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;

bskymain.tsx1 match

@stevekrouse•Updated 6 months ago
9 "https://public.api.bsky.app/xrpc/app.bsky.feed.getAuthorFeed?actor=stevekrouse.com&filter=posts_no_replies";
10
11 const data: Feed = await fetch(url).then((r) => r.json());
12
13 return new Response(

funnyAmaranthCrabmain.tsx3 matches

@savinoventura•Updated 6 months ago
4};
5
6// Fetches a random joke.
7function fetchRandomJoke() {
8 const SAMPLE_JOKE = {
9 "setup": "What do you call a group of disorganized cats?",
14}
15
16const randomJoke = fetchRandomJoke();
17const setup = randomJoke.setup;
18const punchline = randomJoke.punchline;

valSessionmain.tsx2 matches

@maxm•Updated 6 months ago
28
29 try {
30 // Fetch user data
31 const resp = await client.me.profile.retrieve();
32 const token = jwt.sign(resp, privateKeyPem, { algorithm: "RS256", expiresIn: "1h" });
142}
143
144export default app.fetch.bind(app);

bskymain.tsx1 match

@wilhelm•Updated 6 months ago
8 const url = "https://public.api.bsky.app/xrpc/app.bsky.feed.getAuthorFeed?actor=wilb.me&filter=posts_no_replies";
9
10 const data: Feed = await fetch(url).then((r) => r.json());
11
12 return new Response(

HN-fetch-call3 file matches

@ImGqb•Updated 27 mins ago
fetch HackerNews by API

FRAMERFetchBasic1 file match

@bresnik•Updated 2 days ago