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=283&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 3120 results for "fetch"(310ms)

honoExamplemain.tsx1 match

@maxm•Updated 11 months ago
4app.get("/", (c) => c.text("Hello from Hono!"));
5app.get("/yeah", (c) => c.text("Routing!"));
6export default app.fetch;

staticChessV2main.tsx2 matches

@maxm•Updated 11 months ago
10
11 constructor() {}
12 async fetch(req: Request): Promise<Response> {
13 if (new URL(req.url).pathname === "/robots.txt") {
14 return new Response("User-agent: *\nDisallow: /");
224const sc = new StaticChess();
225
226export default sc.fetch.bind(sc);

weatherGPTmain.tsx1 match

@stevekrouse•Updated 11 months ago
4let location = "brooklyn ny";
5let lang = "en";
6const weather = await fetch(
7 `https://wttr.in/${location}?lang=${lang}&format=j1`,
8).then(r => r.json());

caloriesmain.tsx2 matches

@stevekrouse•Updated 11 months ago
6
7function esmTown(url) {
8 return fetch(url, {
9 headers: {
10 "User-Agent":
15
16const app = new Hono();
17export default app.fetch;
18
19app.get("/", async (c) =>

limit_model_forkmain.tsx2 matches

@std•Updated 11 months ago
24 const authHeader = req.headers.get("Proxy-Authorization") || req.headers.get("Authorization");
25 const token = authHeader ? parseBearerString(authHeader) : undefined;
26 const meRes = await fetch(`${API_URL}/v1/me`, { headers: { Authorization: `Bearer ${token}` } });
27 if (!meRes.ok) {
28 return new Response("Unauthorized", { status: 401 });
46 headers.set("OpenAI-Organization", Deno.env.get("OPENAI_API_ORG"));
47
48 const openAIRes = await fetch(url, {
49 method: req.method,
50 headers,

tinygoHttpExampleREADME.md1 match

@maxm•Updated 11 months ago
16
17import { wasmHandler } from "https://esm.town/v/maxm/tinygoHttp";
18const resp = await fetch("https://maxm-wasmblobhost.web.val.run/jpxqvyy5tphiwehzklmioklpkpz4gpzs.wasm");
19const handler = await wasmHandler(new Uint8Array(await resp.arrayBuffer()));
20export default async function(req: Request): Promise<Response> {

cron_client_react_forkmain.tsx1 match

@stevekrouse•Updated 11 months ago
29 e.preventDefault();
30 setLoading(true);
31 const cron = await fetch("/compile", {
32 method: "POST",
33 body: new FormData(e.target as HTMLFormElement),

cron_client_side_script_forkmain.tsx2 matches

@stevekrouse•Updated 11 months ago
5
6const app = new Hono();
7export default app.fetch;
8app.get("/", (c) =>
9 c.html(
89 button.disabled = true;
90 button.innerText = "Loading..";
91 const cron = await fetch("/compile", { method: "POST", body: new FormData(form) }).then((r) => r.text());
92 button.disabled = false;
93 button.innerText = "Compile";

getWeathermain.tsx2 matches

@stevekrouse•Updated 11 months ago
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON";
2
3export async function getWeather(location: string): Promise<WeatherResponse> {
4 return fetchJSON(`https://wttr.in/${location}?format=j1`);
5}
6

harlequinCobramain.tsx2 matches

@stevekrouse•Updated 11 months ago
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON";
2
3export async function getWeather(city: string): Promise<WeatherResponse> {
4 return fetchJSON(`https://wttr.in/${city}?format=j1`);
5}
6

fetchPaginatedData2 file matches

@nbbaier•Updated 1 week ago

tweetFetcher2 file matches

@nbbaier•Updated 1 week ago