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=644&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"(1668ms)

BalanceBrightDatamain.tsx4 matches

@augustohp•Updated 1 year ago
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON";
2
3export default async function fetchBrightDataBalance(
4 token: string,
5): Promise<number> {
6 try {
7 const result = await fetchJSON(
8 "https://api.brightdata.com/customer/balance",
9 {
14 return result.balance - result.pending_costs;
15 } catch (e) {
16 throw new Error(`Could not fetch balance (${e}).`);
17 }
18}

authIdExampleCommentsmain.tsx1 match

@postpostscript•Updated 1 year ago
52});
53
54export default app.fetch;
55
56async function createPage(c: Context<HonoEnvOptional>) {

apiProxymain.tsx3 matches

@postpostscript•Updated 1 year ago
21 const req = c.req.raw;
22 console.log(c.req.path);
23 return fetch(`https://api.val.town${c.req.path}`, {
24 method: req.method,
25 body: req.body,
34const ENDPOINT = getValEndpointFromUrl(import.meta.url);
35export function api(path: string, token: string, init: RequestInit = {}) {
36 return fetch(`${ENDPOINT}/${path.replace(/^\/+/, "")}`, {
37 ...init,
38 headers: {
43}
44
45export default app.fetch;

jwksUtilsmain.tsx1 match

@postpostscript•Updated 1 year ago
65 const url = getValEndpointFromName(`@${author}/jwks`);
66 const method = createVerifyMethod(() => {
67 return fetch(url)
68 .then(res => res.json())
69 .then(({ keys }) => keys);

whiteXerinaemain.tsx2 matches

@stevekrouse•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 default modifyFetchHandler(passwordAuth(app.fetch));

whiteThrushmain.tsx1 match

@stevekrouse•Updated 1 year ago
146});
147
148export default passwordAuth(app.fetch);

password_authmain.tsx4 matches

@stevekrouse•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 (_) {
13app.get("/", (c) => c.html(Layout`${userActionsDisplay(c.get("auth"))}` as string));
14
15export default app.fetch;

cyanPanthermain.tsx1 match

@yusukebe•Updated 1 year ago
5app.get("/", (c) => c.text("Hello Val!!!"));
6
7export default app.fetch;

moccasinMoosemain.tsx1 match

@yusukebe•Updated 1 year ago
5app.get("/", (c) => c.text("Hello Val!"));
6
7export default app.fetch;

fetchPaginatedData2 file matches

@nbbaier•Updated 1 week ago

FetchBasic1 file match

@fredmoon•Updated 1 week ago