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=677&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 8234 results for "fetch"(872ms)

blogSqliteUniverseREADME.md3 matches

@postpostscriptUpdated 1 year ago
6### Val Town-Hosted SQLite
7
8[Val Town](https://val.town/) hosts SQLite as part of its standard library ([@std/sqlite](https://val.town/v/std/sqlite)). This makes a fetch request against their closed-source API (using your API token) which returns results in a consistent format. This is great because you can host your own endpoints that work similarly, and _reuse code that was only designed in mind for that original hosted interface_
9
10The standard format (abridged to important fields):
143#### Default `options.interfaces.patterns`:
144
145- `patterns.https` - `/^https:\/\//` ( `https://example.com/somePath/tableName`): fetch from `https://example.com/somePath/batch`
146- `patterns.val` - `/^@/` (`@author/name/somePath/tableName`): fetch from the val's endpoint, `https://author-name.web.val.run/somePath/batch`
147
148#### Other Available Patterns:

cdnREADME.md5 matches

@pomdtrUpdated 1 year ago
13## Examples
14
15### Fetching the val code
16
17```console
21You can also use `js`, `jsx` and `ts` extension (only the content-type change, there is no transpilation).
22
23### Fetching private val
24
25Pass an api token as an username
29```
30
31### Fetching the val README
32
33```console
41```
42
43### Fetching a specific version of a val
44
45```console
49You need to be authenticated to use this method.
50
51### Fetching the val metadata
52
53```console

mdViewermain.tsx3 matches

@vladimyrUpdated 1 year ago
1// SPDX-License-Identifier: 0BSD
2import { fetchVal } from "https://esm.town/v/vladimyr/fetchVal";
3import { serveReadme } from "https://esm.town/v/vladimyr/serveReadme";
4import { toHonoHandler } from "https://esm.town/v/vladimyr/toHonoHandler";
11 const { author, name } = c.req.param();
12 const query = c.req.query();
13 const { readme } = await fetchVal(author, name);
14 // @see: https://datatracker.ietf.org/doc/html/rfc7763
15 c.header("content-type", "text/markdown; charset=UTF-8; variant=GFM");
17});
18
19export default router.fetch;

mdViewerREADME.md1 match

@vladimyrUpdated 1 year ago
4
5ℹ️ As expected, I'm late to the party 😅 so go ahead and check out @pomdtr's wonderful @pomdtr/cdn val:
6https://www.val.town/v/pomdtr/cdn#fetching-the-val-readme
7
8## Usage

sqliteExplorerAppmain.tsx1 match

@postpostscriptUpdated 1 year ago
267});
268
269export default app.fetch;

pctPermitCheckermain.tsx3 matches

@erlenstarUpdated 1 year ago
1import dayjs from "npm:dayjs";
2
3// fetch("https://portal.permit.pcta.org/availability/mexican-border.php").then(resp => console.log(resp.body));
4// import { fetchText } from "https://esm.town/v/stevekrouse/fetchText?v=6";
5// import { load } from "npm:cheerio";
6
7// const html = await fetchText(
8// "https://portal.permit.pcta.org/availability/mexican-border.php",
9// );

weatherGPTmain.tsx3 matches

@liaolileUpdated 1 year ago
1import { email } from "https://esm.town/v/std/email?v=11";
2import { fetch } from "https://esm.town/v/std/fetch";
3import { OpenAI } from "npm:openai";
4
5let location = "shenzhen";
6let lang = "zh";
7const weather = await fetch(
8 `https://wttr.in/${location}?lang=${lang}&format=j1`,
9).then(r => r.json());
29
30export async function weatherGPT() {
31 const result = await fetch(`https://hello.liaolile.com/test/weather`, {
32 method: "POST",
33 body: JSON.stringify({

umdImportmain.tsx1 match

@easrngUpdated 1 year ago
1export async function umdImport(url: string | URL, globals = {}) {
2 const res = await fetch(url);
3 if (!res.ok) throw new Error(await res.text());
4 let code = await res.text();

bookmarkletsmain.tsx1 match

@vladimyrUpdated 1 year ago
97});
98
99export default app.fetch;

newValURL_examplemain.tsx2 matches

@vladimyrUpdated 1 year ago
1import { shortenURL } from "https://esm.town/v/vladimyr/dubShortenURL";
2import { fetchVal } from "https://esm.town/v/vladimyr/fetchVal";
3import { newValURL } from "https://esm.town/v/vladimyr/newValURL";
4
5const { code } = await fetchVal("vladimyr", "newValURL");
6const valURL = newValURL(code);
7console.log(valURL.href);

fetchPaginatedData2 file matches

@nbbaierUpdated 1 week ago

FetchBasic1 file match

@fredmoonUpdated 1 week ago