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=743&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 7895 results for "fetch"(2008ms)

holidaysUSmain.tsx2 matches

@brenton•Updated 1 year ago
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=41";
2
3// Public holidays in the US in 2023
4export let holidaysUS = fetchJSON(
5 "https://date.nager.at/api/v2/publicholidays/2023/US"
6);

getActivityAndGiphymain.tsx3 matches

@simply_say_m•Updated 1 year ago
1import { fetchGiphy as fetchGiphy2 } from "https://esm.town/v/simply_say_m/fetchGiphy";
2import { boredActivities } from "https://esm.town/v/simply_say_m/boredActivities";
3
5 (async (req: express.Request, res: express.Response) => {
6 const activity = await boredActivities();
7 const fetchGiphy = await fetchGiphy2(activity);
8 const { url } =
9 fetchGiphy[Math.floor(Math.random() * 10)].images.downsized_large;
10 return res.send(
11 `<div style='min-height:100vh; width: 100vw; margin:0; background: radial-gradient(circle, rgba(251,159,63,1) 54%, rgba(255,186,253,1) 100%);'>

nameTopHNThreadUsingSomeonesValmain.tsx2 matches

@elsif_maj•Updated 1 year ago
1import { fetchText } from "https://esm.town/v/stevekrouse/fetchText?v=5";
2
3export let nameTopHNThreadUsingSomeonesVal = (async () => {
4 // Cheerio parses markup and provides an API to interact with the resulting data structure
5 const cheerio = await import("npm:cheerio"); // You can import NPM packages
6 const replyText = await fetchText(
7 "https://news.ycombinator.com/",
8 );

proxyFetchmain.tsx5 matches

@alp•Updated 1 year ago
1import { fetch } from "https://esm.town/v/std/fetch";
2
3export const proxyFetch = 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 }
9 catch (e) {
10 const errorMessage = e instanceof Error ? e.message : "Unknown error";
11 console.error("Failed to initiate fetch", e);
12 return res.status(500).send(`Failed to initiate fetch: ${errorMessage}`);
13 }
14};

checkStatusmain.tsx3 matches

@louis•Updated 1 year ago
1import { fetch } from "https://esm.town/v/std/fetch";
2
3export const checkStatus = async (
6): Promise<number> => {
7 try {
8 const response = await fetch(url);
9 console.log(`Fetched ${url}`);
10 const statusCode = response.status;
11 return statusCode;

basicsWithBabishRssmain.tsx2 matches

@diit•Updated 1 year ago
1import { fetch } from "https://esm.town/v/std/fetch";
2
3export async function basicsWithBabishRss(req: express.Request, res) {
10 async function generateRssFeed() {
11 const { parseDocument } = await import("npm:htmlparser2");
12 const response = await fetch("https://basicswithbabish.co/episodes");
13 const body = await response.text();
14 const dom = parseDocument(body);

kpunkShowmain.tsx2 matches

@aeaton•Updated 1 year ago
1import { fetchHtmlDom } from "https://esm.town/v/aeaton/fetchHtmlDom";
2
3export async function kpunkShow(url) {
4 const dom = await fetchHtmlDom(url);
5 const date = dom.querySelector(".postDate")?.textContent.trim();
6 const titleNode = dom.querySelector(".postTitle .postTitle");

etherealExtractormain.tsx2 matches

@zerilliworks•Updated 1 year ago
1import { fetch } from "https://esm.town/v/std/fetch";
2
3export const etherealExtractor = async function (
20 return res.status(400).send({ message: "email_id is required" });
21 const sourceUrl = `https://ethereal.email/message/${email_id}/message.eml`;
22 const resource = await fetch(sourceUrl);
23 const eml = await resource.text();
24 const headerEndsAt = eml.search(/\n\s+\n/);

starWarsmain.tsx2 matches

@dosirak•Updated 1 year ago
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=41";
2
3export let starWars = fetchJSON(
4 "https://swapi.dev/api/people/1/"
5);

ipmain.tsx2 matches

@ian•Updated 1 year ago
1import { fetchJSON } from "https://esm.town/v/ian/fetchJSON";
2
3export let ip = await fetchJSON("https://api.ipify.org?format=json ");

fetchPaginatedData2 file matches

@nbbaier•Updated 1 week ago

FetchBasic1 file match

@fredmoon•Updated 1 week ago