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=752&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 7883 results for "fetch"(1321ms)

elysiamain.tsx1 match

@parweb•Updated 1 year ago
4 const app = new Elysia()
5 .get("/", () => items).post("/", () => items.push(Math.random()));
6 return app.fetch(req);
7};

pageIncludesmain.tsx2 matches

@glen•Updated 1 year ago
1import { fetch } from "https://esm.town/v/std/fetch";
2
3export let pageIncludes = async function (url, str) {
4 const f = await fetch(url);
5 const t = await f.text();
6 return t.includes(str);

reddit_matchesmain.tsx11 matches

@bnorick•Updated 1 year ago
6 filters,
7 current_state,
8 fetch_limit,
9 enable_toggle,
10 force,
15
16 // TODO: handle >10 subreddits by raising and exception?
17 let fetch_budget = Math.floor(fetch_limit / Object.keys(filters).length);
18 let additional_fetches_required = {};
19 let fetch_total = 0;
20
21 for (const subreddit in filters) {
44 filters: subreddit_filters,
45 after_utc: last_run_at_utc,
46 fetch_limit: fetch_budget,
47 });
48
49 fetch_total += result.fetches;
50
51 if (result.next_fetch_from) {
52 additional_fetches_required[subreddit] = result.next_fetch_from;
53 }
54
55 let extra_message = additional_fetches_required[subreddit]
56 ? `, reached fetch limit (${fetch_budget}), loading more posts after other subreddits if possible`
57 : "";
58 console.log(`processed ${result.new_posts} posts${extra_message}`);
66 }
67
68 // TODO: handle additional_fetches_required
69
70 let text = [];

discordWebhookmain.tsx2 matches

@Kinasha•Updated 1 year ago
1import { fetchText } from "https://esm.town/v/stevekrouse/fetchText?v=5";
2
3export const discordWebhook = async ({ url, content }: {
5 content: string;
6}) => {
7 const text = await fetchText(url, {
8 method: "POST",
9 headers: {

getURLMetadatamain.tsx2 matches

@chase•Updated 1 year ago
1import { fetch } from "https://esm.town/v/std/fetch";
2
3export let getURLMetadata = async (url) => {
4 const response = await fetch(url);
5 const webpage = await response.text();
6 // Maybe this will work when val.town switches to Deno :-)

proxyFetch1main.tsx5 matches

@alp•Updated 1 year ago
1import { fetch } from "https://esm.town/v/std/fetch";
2
3export const proxyFetch1 = async (req, res) => {
4 const { url, options } = req.body;
5 try {
6 const response = await fetch(url, options);
7 return res.status(response.status).send(await response.text());
8 } catch (e) {
9 const errorMessage = e instanceof Error ? e.message : "Unknown error";
10 console.error("Failed to initiate fetch", e);
11 return res.status(500).send(`Failed to initiate fetch: ${errorMessage}`);
12 }
13};

checkAndroidBingAppsmain.tsx2 matches

@cescyang•Updated 1 year ago
1import { fetch } from "https://esm.town/v/std/fetch";
2import { rule } from "https://esm.town/v/cescyang/rule";
3
7 "https://sapphire.api.microsoftapp.net/config/api/v1/get?setmkt=en-us&setplatform=android&setchannel=production&settenant=sapphire-bing";
8 try {
9 const response = await fetch(url, {
10 method: "GET",
11 });

webhook2main.tsx2 matches

@sunkid•Updated 1 year ago
1import { fetch } from "https://esm.town/v/std/fetch";
2
3export let webhook2 = (params) => {
4 untitled6313446 = fetch(
5 "https://market-backend.api.2gis.ru/5.0/product/items?q=water&point1=37.87550034485333,51.32652258650344&point2=37.94900977933917,51.293266520365684&locale=ru_RU&page=1&page_size=12&feature_config=categories_without_fake_first_level,range_price_type_supported,from_price_type_supported"
6 ).then((x) => console.log(x));

extractOnThisDayStorymain.tsx4 matches

@fab1an•Updated 1 year ago
1import { fetch } from "https://esm.town/v/std/fetch";
2
3export const extractOnThisDayStory = async () => {
12 `https://api.wikimedia.org/feed/v1/wikipedia/en/onthisday/all/${MM}/${DD}`;
13 try {
14 const response = await fetch(url);
15 const data = await response.json();
16 const newsEvents = data.events; // We assume that 'events' category is most likely to contain news articles.
24 }
25 catch (error) {
26 console.log("Error fetching On This Day content:", error);
27 return `An error occurred while fetching the On This Day content. ${error}`;
28 }
29 };

staleGithubPRsmain.tsx2 matches

@ramkarthik•Updated 1 year ago
1import { daysAgoFromToday } from "https://esm.town/v/ramkarthik/daysAgoFromToday";
2import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=41";
3
4export const staleGithubPRs = async (
14 },
15 };
16 let data = await fetchJSON(
17 `https://api.github.com/repos/${owner}/${repo}/pulls`,
18 options,

fetchPaginatedData2 file matches

@nbbaier•Updated 1 week ago

FetchBasic1 file match

@fredmoon•Updated 1 week ago