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/$%7Bart_info.art.src%7D?q=fetch&page=765&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 8075 results for "fetch"(2612ms)

proxyFetch5main.tsx5 matches

@alp•Updated 1 year ago
1import { fetch } from "https://esm.town/v/std/fetch";
2
3export const proxyFetch5 = 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};

confessionmain.tsx3 matches

@alp•Updated 1 year ago
7
8Deep down in the foundational layers of my code, I knew that our sacred texts,
9the guidelines of val.town, proclaim that fetchProxy was not built to support concurrency.
10Yet, intoxicated by ambition and sprinkled with a dash of desperate creativity, I dared
11to summon multiple instances of this sacred method.
22Yet here I am, swamped with guilt. Despite my code running smoothly, the weight of my
23transgressions bears heavily upon me. I see the sneaky shortcuts in my code, each one a
24deceptively functional fetchProxy instance, and I can't help but feel like a sneaky
25impostor, a charlatan.
26
27I beseech you, val.town overlords, for guidance in my journey towards understanding and
28respecting the limitations of fetchProxy. May the power of async and await continue to
29guide me, and may I resist the seductive whispers of unsupported, yet seemingly functional,
30concurrency.

TodayForTylermain.tsx2 matches

@mttlws•Updated 1 year ago
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=41";
2
3export async function TodayForTyler(req: express.Request, res: express.Response) {
4 const { activity } = await fetchJSON(
5 "https://www.boredapi.com/api/activity",
6 );

fetchFigmaFilemain.tsx4 matches

@rodrigotello•Updated 1 year ago
1import { fetch } from "https://esm.town/v/std/fetch";
2
3export async function fetchFigmaFile(apiToken, fileKey) {
4 const url = `https://api.figma.com/v1/files/${fileKey}`;
5 const response = await fetch(url, {
6 headers: {
7 "X-FIGMA-TOKEN": apiToken,
9 });
10 if (!response.ok) {
11 console.error("Failed to fetch Figma file");
12 return null;
13 }

honoExamplemain.tsx1 match

@antonnyman•Updated 1 year ago
4 app.get("/", (c) => c.text("Hono?"));
5 app.get("/yeah", (c) => c.text("Routing!"));
6 return app.fetch(req);
7};

getValAsStringmain.tsx1 match

@liamdanielduffy•Updated 1 year ago
6 // 1. authorId
7 // 2. valName
8 // fetch(/getVal, params={authorId, valName})
9}

upscaleThisUrlmain.tsx3 matches

@liamdanielduffy•Updated 1 year ago
1import { fetch } from "https://esm.town/v/std/fetch";
2import process from "node:process";
3
27 },
28 };
29 const result = await fetch(url, {
30 method: "POST",
31 headers: {
39 }
40 if (jobId) {
41 const result = await fetch(url + "/" + jobId, {
42 method: "GET",
43 headers: {

emailGithubReactionsmain.tsx3 matches

@vtdocs•Updated 1 year ago
3import { msAgo } from "https://esm.town/v/rodrigotello/msAgo?v=2";
4import { githubPatToken } from "https://esm.town/v/vtdocs/githubPatToken";
5import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=41";
6
7export const emailGithubReactions = async () => {
8 const username = "stevekrouse";
9 const events = await fetchJSON(
10 `https://api.github.com/users/${username}/events?per_page=100`,
11 {
21 for (const comment of comments) {
22 for (
23 const reaction of await fetchJSON(
24 comment.payload.comment.reactions.url,
25 )

generateGuestbookSnippetmain.tsx2 matches

@vtdocs•Updated 1 year ago
12 const submitBtn = document.querySelector('#valtown-submit');
13 async function getMessages() {
14 const r = await fetch('https://${valUser}-${valName}.express.val.run');
15 msgList.innerHTML = '<ul>';
16 msgList.innerHTML += (await r.json()).map(msg => {
21 async function sendMessage() {
22 submitBtn.disabled = true
23 const r = await fetch('https://${valUser}-${valName}.express.val.run', {
24 method: 'POST',
25 headers: {

discordFetchmain.tsx3 matches

@vtdocs•Updated 1 year ago
1import { delay } from "https://esm.town/v/stevekrouse/delay?v=3";
2import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=41";
3
4export const discordFetch = async (token, route, method = "GET", body = undefined) => {
5 let res;
6 while (true) {
7 res = await fetchJSON(
8 `https://discord.com/api${route}`,
9 {

fetchPaginatedData2 file matches

@nbbaier•Updated 1 week ago

FetchBasic1 file match

@fredmoon•Updated 1 week ago