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=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 8156 results for "fetch"(7513ms)

buddhaRandomQuotemain.tsx2 matches

@noaoh•Updated 1 year ago
1import { fetch } from "https://esm.town/v/std/fetch";
2
3export const buddhaRandomQuote = (async () => {
4 const resp = await fetch("https://buddha-api.com/api/random");
5 const j = await resp.json();
6 const { text, byName } = j;

annoymain.tsx2 matches

@ajax•Updated 1 year ago
1import { fetch } from "https://esm.town/v/std/fetch";
2import process from "node:process";
3import { resume as resume2 } from "https://esm.town/v/ajax/resume";
50 `;
51 console.log({ prompt });
52 const response = await fetch("https://api.openai.com/v1/completions", {
53 method: "POST",
54 headers: {

fetchRssParsermain.tsx4 matches

@shellphon•Updated 1 year ago
1import { fetch } from "https://esm.town/v/std/fetch";
2
3export async function fetchRssParser(rssUrl) {
4 // fetch the rss xml
5 const rssResult = await fetch(rssUrl).then((res) => res.text());
6 // parse xml to object
7 const { XMLParser } = await import("npm:fast-xml-parser");

finalUrlmain.tsx2 matches

@neverstew•Updated 1 year ago
1import { fetch } from "https://esm.town/v/std/fetch";
2
3export async function finalUrl(req: Request) {
4 const url = new URL(req.url).pathname.replace(/^\//, "");
5 const response = await fetch(url);
6 return new Response("", {
7 headers: {

aliasmain.tsx2 matches

@neverstew•Updated 1 year ago
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=41";
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 = {

valToStringmain.tsx2 matches

@pomdtr•Updated 1 year ago
1import { fetch } from "https://esm.town/v/std/fetch";
2
3export async function valToString(val: string) {
6 }
7 const [author, name] = val.split(".");
8 const resp = await fetch(`https://api.val.town/v1/alias/${author}/${name}`);
9 if (resp.status !== 200) {
10 throw new Error(resp.statusText);

todosPlaceholdermain.tsx2 matches

@pomdtr•Updated 1 year ago
1import { fetch } from "https://esm.town/v/std/fetch";
2
3export const todosPlaceholder = (async () => {
4 const resp = await fetch("https://jsonplaceholder.typicode.com/todos");
5 return resp.json();
6})();

chatmain.tsx1 match

@nimalu•Updated 1 year ago
24 document.getElementById("message-input").value = '';
25 const ul = document.getElementById("inbox");
26 const data = await fetch("https://api.val.town/eval/@nimalu.sendChatMessage('" + message + "','"+ sender + "')")
27 .then(res => res.json())
28 .then(res => res.data)

testPostCallmain.tsx2 matches

@mehmet•Updated 1 year ago
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=41";
2
3export async function testPostCall() {
4 const result = await fetchJSON(
5 "https://api.val.town/express/@stevekrouse.postWebhook1",
6 {

pageApimain.tsx2 matches

@mgruel•Updated 1 year ago
1import { fetchJSON } from "https://esm.town/v/mgruel/fetchJSON";
2
3type PaginatedData<T> = {
22 nextUrl.searchParams.set("limit", `${limit}`);
23 while (nextUrl) {
24 const { data, links } = await fetchJSON<PaginatedData<T>>(
25 nextUrl,
26 options,

fetchPaginatedData2 file matches

@nbbaier•Updated 1 week ago

FetchBasic1 file match

@fredmoon•Updated 1 week ago