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=230&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 2383 results for "fetch"(274ms)

valentines_day_card_generatorfrontend_card1 match

@shouser•Updated 2 months ago
20 stock_image: "3",
21 });
22 const response = await fetch(`/image?${params.toString()}`, {
23 method: "GET",
24 });

valentines_day_card_generatorimage_uploader1 match

@shouser•Updated 2 months ago
38 formData.append("type", imageType);
39
40 fetch("/upload", {
41 method: "POST",
42 body: formData,

utilitiesreadme.md3 matches

@nbbaier•Updated 2 months ago
1# Pagination Utilities
2
3## Fetch Paginated Data
4
5This val exports a function that loops through paginated API responses and returns the combined data as an array. It expects pagination with `next` and there to be a `data` property in the API response. This conforms to the Val Town API, so this function is useful when fetching paginated Val Town API responses for creating custom folders in [pomdtr's vscode extension](https://github.com/pomdtr/valtown-vscode).
6
7Usage:
9```ts
10const id = <vt user id>
11await fetchPaginatedData(`https://api.val.town/v1/users/${id}/vals`, {
12 headers: { Authorization: `Bearer ${Deno.env.get("valtown")}` },
13});

utilitiesfetchPaginatedData4 matches

@nbbaier•Updated 2 months ago
1import { fetch } from "https://esm.town/v/std/fetch?v=4";
2
3export async function fetchPaginatedData(url: string, init?: RequestInit, limit: number = 100) {
4 let u = new URL(url);
5 u.searchParams.set("limit", String(limit));
8 const data = [];
9 while (true) {
10 const resp = await fetch(url, init);
11 if (!resp.ok) {
12 throw new Error(`Fetch failed with status ${resp.status}`);
13 }
14 const body = await resp.json();

testprojectindex1 match

@moe•Updated 2 months ago
3
4const app = new Hono();
5export default app.fetch;
6
7app.get("/", async (c) => {

hardballcitysubmitLink1 match

@flymaster•Updated 2 months ago
9 const app = await getApp();
10
11 return app.fetch(req);
12}
13

hardballcitymlbCron1 match

@flymaster•Updated 2 months ago
7 timeout: 5000,
8 });
9 let feedFile = await fetch("https://mlb.com/feeds/news/rss.xml");
10 let feedText = await feedFile.text();
11 let feedData = await parser.parseString(feedText);

SideProjectSaturdayindex.tsx1 match

@zeko•Updated 2 months ago
137});
138
139export default app.fetch;

statusmonitor2 matches

@rkda•Updated 2 months ago
12 const start = performance.now();
13 try {
14 const res = await fetch(url);
15 end = performance.now();
16 status = res.status;
23 } catch (e) {
24 end = performance.now();
25 reason = `couldn't fetch: ${e}`;
26 ok = false;
27 console.log(`Website down (${url}): ${reason} (${end - start}ms)`);

statusmonitor2 matches

@kevan•Updated 2 months ago
12 const start = performance.now();
13 try {
14 const res = await fetch(url);
15 end = performance.now();
16 status = res.status;
23 } catch (e) {
24 end = performance.now();
25 reason = `couldn't fetch: ${e}`;
26 ok = false;
27 console.log(`Website down (${url}): ${reason} (${end - start}ms)`);

fetchPaginatedData2 file matches

@nbbaier•Updated 4 days ago

tweetFetcher2 file matches

@nbbaier•Updated 1 week ago