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=1304&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 14439 results for "fetch"(7669ms)

aliasmain.tsx2 matches

@stevekrouse•Updated 1 year ago
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON";
2
3export function alias<P extends Params>(params: P): Promise<Result<P>> {
9 if ("valName" in params && params.token)
10 headers.Authorization = `Bearer ${params.token}`;
11 return fetchJSON(url, { headers });
12}
13type UserParams = {

ssr_react_minimain.tsx1 match

@stevekrouse•Updated 1 year ago
22 const onData = onSubmit ? onSubmit(e) : () => 1;
23 const formData = new FormData(e.target as any);
24 const resp = await fetch("/", {
25 method: props.action ?? "POST",
26 body: formData,

blobertDatamain.tsx2 matches

@rvorias•Updated 1 year ago
1import { fetch } from "https://esm.town/v/std/fetch";
2
3const gist =
5
6export const queryParams = async (req: Request) => {
7 const data = await fetch(gist);
8 const jsonData = await data.json();
9

postRequestExamplemain.tsx2 matches

@stevekrouse•Updated 1 year ago
1// make POST fetch to https://stevekrouse-parsePostBodyExample.web.val.run
2console.log(
3 await (await fetch("https://stevekrouse-parsePostBodyExample.web.val.run", {
4 method: "POST",
5 headers: {

googlePhotosMarketingRSSmain.tsx3 matches

@Glench•Updated 1 year ago
1import { dataToRSS } from "https://esm.town/v/Glench/dataToRSS";
2import { fetch } from "https://esm.town/v/std/fetch";
3
4async function getOfficialRedditPosts() {
5 const resp = await fetch("https://www.reddit.com/r/googlephotos/.json");
6 if (!resp.ok) return [];
7 const json = await resp.json();
13}
14async function getGoogleSupportForumPosts() {
15 const resp = await fetch(
16 "https://support.google.com/photos/threads?hl=en&max_results=500",
17 );

esmTownTranspileDemoREADME.md1 match

@stevekrouse•Updated 1 year ago
5It doesn't do as much as other transpilers (such as esm.sh, such as rewriting `npm:` imports, etc). We may add that capability in the future. For now, if you want your npm imports to run in the browser, use `https://esm.sh/package` instead of `npm:package`.
6
7The below script demonstrates this transiplation behavior by fetching its own source code (`import.meta.url`) with the user agent of a browser. You can uncoment the line setting the browser agent if you want to see the difference in the output. Or you could just load this val's module URL in your browser to see the untranspiled TS.
8
9As of July 23, 2024, this is the code that determines when esm.town transpiles or not:

draggableItemsmain.tsx1 match

@nbbaier•Updated 1 year ago
90});
91
92export default app.fetch;

open_in_valtownmain.tsx1 match

@stevekrouse•Updated 1 year ago
3
4/**
5 * @param handler Fetch handler
6 */
7export default function openInValTown(

isMyWebsiteDownmain.tsx3 matches

@thierryc•Updated 1 year ago
1import { email } from "https://esm.town/v/std/email";
2import { fetch } from "https://esm.town/v/std/fetch";
3
4export const isMyWebsiteDown = async () => {
8 let reason: string;
9 try {
10 const res = await fetch(URL);
11 if (res.status !== 200) {
12 reason = `(status code: ${res.status})`;
14 }
15 } catch (e) {
16 reason = `couldn't fetch: ${e}`;
17 ok = false;
18 }

flydotioRSSmain.tsx1 match

@mstubbs•Updated 1 year ago
3
4export async function flydotioRSS(req: Request): Promise<Response> {
5 const response = await fetch("https://fly.io/blog/");
6 const body = await response.text();
7 const $ = cheerio.load(body);

testWeatherFetcher1 file match

@sjaskeprut•Updated 20 hours ago

weatherFetcher1 file match

@sjaskeprut•Updated 20 hours ago