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=640&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 7881 results for "fetch"(1136ms)

getLatestGitCoreVersionmain.tsx2 matches

@freecrayon•Updated 1 year ago
1import { fetch } from "https://esm.town/v/std/fetch";
2
3export default async function(request: Request): Promise<Response> {
6
7 const cheerio = await import("https://esm.sh/cheerio@1.0.0-rc.12");
8 const response = await fetch(
9 "https://launchpad.net/~git-core/+archive/ubuntu/ppa/+packages",
10 );

discord_note_to_selfmain.tsx3 matches

@wittjosiah•Updated 1 year ago
3) {
4 if (!dmId) {
5 console.log("Fetching dmId...", { userId });
6 const channelResponse = await fetch("https://discord.com/api/users/@me/channels", {
7 method: "POST",
8 headers: {
23 console.log("sending", body);
24
25 const dmResponse = await fetch(`https://discord.com/api/channels/${dmId}/messages`, {
26 method: "POST",
27 headers: {

resilientFetchmain.tsx5 matches

@easrng•Updated 1 year ago
1import { API_URL } from "https://esm.town/v/std/API_URL";
2async function proxiedFetch(req: Request): Promise<Response> {
3 let query = new URLSearchParams({
4 url: req.url,
6 const headers = new Headers(req.headers);
7 headers.set("X-Valtown-Authorization", `Bearer ${Deno.env.get("valtown")}`);
8 return fetch(`${API_URL}/v1/fetch?${query}`, {
9 ...req,
10 headers,
12}
13import isNetworkError from "npm:is-network-error@1.0.1";
14export const resilientFetch: typeof fetch = async (input: RequestInfo | URL, init?: RequestInit): Promise<Response> => {
15 const req = new Request(input, init);
16 try {
17 const res = await fetch(req);
18 if (res.ok) {
19 return res;
24 }
25 }
26 return await proxiedFetch(req);
27};

resilientFetchREADME.md2 matches

@easrng•Updated 1 year ago
1# `resilientFetch`: faster @std/fetch
2Try to fetch unproxied first, and fall back to proxied fetch if that fails.

reactExamplemain.tsx2 matches

@Negash•Updated 1 year ago
1/** @jsxImportSource https://esm.sh/react */
2import { modifyFetchHandler } from "https://esm.town/v/andreterron/codeOnValTown?v=46";
3import { sqlite } from "https://esm.town/v/std/sqlite?v=4";
4import tailwindURL from "https://esm.town/v/stevekrouse/tailwindURL";
5import { renderToString } from "npm:react-dom/server";
6
7export const reactExample = modifyFetchHandler(async (request: Request) => {
8 const url = new URL(request.url);
9 if (url.pathname === "/favicon.ico") return new Response(null, { status: 404 });

insecureSSLCertExampleREADME.md1 match

@stevekrouse•Updated 1 year ago
1This is an example call of @stevekrouse/insecureFetch
2
3Migrated from folder: Archive/insecureSSLCertExample

lua_wasi_examplemain.tsx1 match

@vladimyr•Updated 1 year ago
13
14const url = "https://unpkg.com/@antonz/lua-wasi/dist/lua.wasm";
15const result = await WASI.start(fetch(url), {
16 args: ["lua", "/program.lua"],
17 stdout: (out) => console.log(out),

signInWithValTownDemomain.tsx1 match

@easrng•Updated 1 year ago
131 );
132});
133export default signInWithValTown(app.fetch);

buttonmain.tsx2 matches

@easrng•Updated 1 year ago
5 for (const urlMatch of cssString.matchAll(urlRegex)) {
6 const originalUrl = urlMatch[1];
7 const response = await fetch(originalUrl);
8 const data = new Uint8Array(await response.arrayBuffer());
9 result = result.replace(
26 let fontCss = "";
27 try {
28 const r = await fetch(
29 "https://fonts.googleapis.com/css2?family="
30 + encodeURIComponent("IBM Plex Sans:wght@600")

usermain.tsx1 match

@easrng•Updated 1 year ago
10 profileImageUrl: string;
11}> =>
12 await (await fetch(`${API_URL}/v1/users/${id}`, {
13 headers: token
14 ? {

fetchPaginatedData2 file matches

@nbbaier•Updated 1 week ago

FetchBasic1 file match

@fredmoon•Updated 1 week ago