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/$%7Bsuccess?q=fetch&page=698&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 8591 results for "fetch"(1271ms)

libraryThatNeedsValidationmain.tsx1 match

@maxm•Updated 1 year ago
1export const newClient = async (username: string, password: string): Client => {
2 const url = `https://${username}-userspaceauth.web.val.run/validate/${password}`;
3 let resp = await fetch(url);
4 if (resp.status !== 200) {
5 throw new Error("Invliad response. Have you set up your fork? https://www.val.town/v/maxm/userspaceauth/fork?");

orangePiranhamain.tsx4 matches

@nethanmadhav•Updated 1 year ago
3// ... imports ...
4
5// Fetches a random joke.
6async function fetchRandomJoke() {
7 const response = await fetch(
8 "https://official-joke-api.appspot.com/random_joke",
9 );
11}
12
13const randomJoke = await fetchRandomJoke();
14const setup = randomJoke.setup;
15const punchline = randomJoke.punchline;

orangeMackerelmain.tsx8 matches

@halgendy•Updated 1 year ago
6// };
7
8// Fetches a random joke.
9// function fetchRandomJoke() {
10// const SAMPLE_JOKE = {
11// "setup": "What do you call a group of disorganized cats?",
15// return SAMPLE_JOKE;
16// }
17// Fetches a random joke.
18// Fetches a random joke.
19async function fetchRandomJoke() {
20 const response = await fetch(
21 "https://official-joke-api.appspot.com/random_joke",
22 );
23 return response.json();
24}
25const randomJoke = await fetchRandomJoke();
26const setup = randomJoke.setup;
27const punchline = randomJoke.punchline;
33});
34
35console.log(fetchRandomJoke());

salmonCrabmain.tsx4 matches

@stevekrouse•Updated 1 year ago
1/** @jsxImportSource https://esm.sh/hono@latest/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";
15import { passwordAuth } from "https://esm.town/v/pomdtr/password_auth?v=70";
16import { ResultSet, sqlite } from "https://esm.town/v/std/sqlite";
17import { reloadOnSaveFetchMiddleware } from "https://esm.town/v/stevekrouse/reloadOnSave";
18import { Hono } from "npm:hono";
19import type { FC } from "npm:hono/jsx";
174});
175
176export const handler = app.fetch;
177export default iframeHandler(modifyFetchHandler(passwordAuth(handler)));

getOpengraphMetadatamain.tsx2 matches

@dvsj•Updated 1 year ago
9 return { "status": 400, "error_msg": "Valid URL is required as input. URL was empty." };
10 }
11 let resp = await fetch(url);
12 let text = await resp.text();
13 // We parse the page as HTML and then pick the data we want.
66
67async function getImageDataFromUrl(url) {
68 const response = await fetch(url);
69 const base64data = Buffer.from(await response.arrayBuffer()).toString("base64");
70 return "data:image/png;base64," + base64data;

roseGullmain.tsx12 matches

@carissacha•Updated 1 year ago
1// Fetches a random joke.
2function fetchRandomJoke() {
3 const response = fetch(
4 "https://official-joke-api.appspot.com/random_joke",
5 );
6 return response;
7}
8function fetchRandomJoke() {
9 const SAMPLE_JOKE = {
10 "setup": "What do you call a group of disorganized cats?",
15}
16
17const randomJoke = fetchRandomJoke();
18console.log(randomJoke.setup); // This will print the setup to the console.
19console.log(randomJoke.punchline); // This will print the punchline to the console.
21import { email } from "https://esm.town/v/std/email?v=9";
22
23// Fetches a random joke.
24function fetchRandomJoke() {
25 const SAMPLE_JOKE = {
26 "setup": "What do you call a group of disorganized cats?",
30}
31
32const randomJoke = fetchRandomJoke();
33const setup = randomJoke.setup;
34const punchline = randomJoke.punchline;
40});
41
42// Fetches a random joke.
43async function fetchRandomJoke() {
44 const response = await fetch(
45 "https://official-joke-api.appspot.com/random_joke",
46 );
48}
49
50const randomJoke = await fetchRandomJoke();
51const setup = randomJoke.setup;
52const punchline = randomJoke.punchline;

moccasinTahrmain.tsx4 matches

@shivaanneu•Updated 1 year 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;

orangeReptilemain.tsx3 matches

@vsp05•Updated 1 year 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;

userspaceAuthmain.tsx1 match

@maxm•Updated 1 year ago
99 return c.json(match, match ? 200 : 401);
100});
101export default app.fetch;
102
103// console.log(await opaque.getOpaqueConfig(opaque.OpaqueID.OPAQUE_P521).ake.generateAuthKeyPair());

untitled_moccasinAmphibianmain.tsx2 matches

@kisen•Updated 1 year ago
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=41";
2import { queryAQI } from "https://esm.town/v/kisen/queryAQI";
3
4export const untitled_moccasinAmphibian = (async () => {
5 let weather = queryAQI("beijing");
6 let push = fetchJSON(
7 "https://api.day.app/UadTW6YQF2ceiAxypDgHe/Body",
8 );

fetchPaginatedData2 file matches

@nbbaier•Updated 2 weeks ago

FetchBasic1 file match

@fredmoon•Updated 2 weeks ago