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=639&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 7880 results for "fetch"(1712ms)

sqliteExplorerAppmain.tsx3 matches

@parkerdavis•Updated 1 year ago
1/** @jsxImportSource https://esm.sh/hono@latest/jsx **/
2import { modifyFetchHandler } from "https://esm.town/v/andreterron/codeOnValTown?v=50";
3import { resetStyle } from "https://esm.town/v/nbbaier/resetStyle";
4import { sqlToCSV, sqlToJSON } from "https://esm.town/v/nbbaier/sqliteExportHelpers";
147});
148
149export const handler = app.fetch;
150
151export default modifyFetchHandler(passwordAuth(handler));

stevekrouse_minimalmain.tsx2 matches

@stevekrouse•Updated 1 year ago
1/** @jsxImportSource https://esm.sh/react */
2import { modifyFetchHandler } from "https://esm.town/v/andreterron/codeOnValTown?v=46";
3import { email } from "https://esm.town/v/std/email?v=11";
4import { sqlite } from "https://esm.town/v/std/sqlite";
19}
20
21export const reactExample = modifyFetchHandler(async (request: Request) => {
22 const url = new URL(request.url);
23 if (url.pathname === "/favicon.ico") return new Response(null, { status: 404 });

subscribe_to_a_substackmain.tsx1 match

@bensu•Updated 1 year ago
18};
19
20const result = await fetch("https://blog.edgeesmeralda.com/api/v1/free", {
21 "headers": {
22 "content-type": "application/json",

blogmain.tsx2 matches

@postpostscript•Updated 1 year ago
12
13app.get("/", (c) => {
14 return app.fetch(new Request(`${httpEndpoint}/blog`));
15});
16
45});
46
47export default app.fetch;

password_authmain.tsx4 matches

@parkerdavis•Updated 1 year ago
60}
61
62async function fetchUser(token: string): Promise<{ id: string }> {
63 const resp = await fetch("https://api.val.town/v1/me", {
64 headers: {
65 Authorization: `Bearer ${token}`,
68
69 if (resp.status !== 200) {
70 throw new Error("Could not fetch user");
71 }
72
76async function verifyApiToken(token: string) {
77 try {
78 const [currentUser, requestUser] = await Promise.all([fetchUser(Deno.env.get("valtown")), fetchUser(token)]);
79 return currentUser.id == requestUser.id;
80 } catch (_) {

viewSourcemain.tsx2 matches

@neverstew•Updated 1 year ago
1import { prettifyHtml } from "https://esm.town/v/neverstew/prettifyHtml";
2import { fetchText } from "https://esm.town/v/stevekrouse/fetchText?v=6";
3import { escape } from "npm:html-sloppy-escaper";
4
5export default async function viewSource(req: Request) {
6 const pathname = new URL(req.url).pathname;
7 const html = await fetchText(pathname === "/" ? "example.com" : pathname).then(prettifyHtml);
8 const body = `<html>
9 <head>

example_ssrmain.tsx3 matches

@pomdtr•Updated 1 year ago
9 setItems([...items]);
10
11 // fetch data from the server
12 fetch("/api/item")
13 .then((res) => res.json())
14 .then((item) => setItems([...items, item]));
30 const url = new URL(req.url);
31 if (url.pathname == "/api/item") {
32 return Response.json("This item is fetched from the server by the client");
33 }
34

Upload_onchain_blobs_to_IPFSmain.tsx4 matches

@stevedylandev•Updated 1 year ago
10 if (hash.startsWith("0x0")) {
11 const hash = new URL(url).pathname.split("/").pop();
12 const urlStream = await fetch(`https://api.blobscan.com/blobs/${hash}`);
13 const arrayBuffer = await urlStream.arrayBuffer();
14 const blob = new Blob([arrayBuffer], { type: "application/json" });
16 data.append("file", file);
17 } else {
18 const tx = await fetch(`https://api.blobscan.com/transactions/${hash}`);
19 const txData = await tx.json();
20
22 let folder = "blobs"
23 await Promise.all(txData.blobs.map(async (blob, index) => {
24 const blobStream = await fetch(`https://api.blobscan.com/blobs/${blob}`);
25 const arrayBuffer = await blobStream.arrayBuffer();
26 const blobFile = new Blob([arrayBuffer], { type: "application/json" });
35 console.log(data);
36
37 const response = await fetch("https://api.pinata.cloud/pinning/pinFileToIPFS", {
38 method: "POST",
39 headers: {
1import { fetch } from "https://esm.town/v/std/fetch";
2
3export default async function(request: Request): Promise<Response> {
4 const cheerio = await import("https://esm.sh/cheerio@1.0.0-rc.12");
5 const response = await fetch("https://releases.1password.com/linux/beta/");
6 const body = await response.text();
7 const $ = cheerio.load(body);

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 );

fetchPaginatedData2 file matches

@nbbaier•Updated 1 week ago

FetchBasic1 file match

@fredmoon•Updated 1 week ago