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=121&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 8596 results for "fetch"(1623ms)

BingImageOfDayindex.tsx7 matches

@wolf•Updated 2 weeks ago
3import { blob } from "https://esm.town/v/std/blob";
4import { backupBingImage } from "./backupImage.tsx";
5import { fetchBingImage } from "./fetchBingImage.tsx";
6
7const app = new Hono();
51app.get("/", async (c) => {
52 try {
53 // Use our helper function to fetch the current Bing image
54 const response = await fetchBingImage();
55 if (!response.ok) throw new Error(`HTTP error! status: ${response.status}`);
56
64 });
65 } catch (error) {
66 return c.json({ error: "Failed to fetch current Bing image" }, 500);
67 }
68});
84 path: "/",
85 method: "GET",
86 description: "Fetches the current Bing Image of the Day.",
87 response: "JPEG image with headers `Content-Type: image/jpeg`.",
88 },
96 path: "/get/:date",
97 method: "GET",
98 description: "Fetches a saved Bing Image of the Day for a specific date.",
99 urlParams: "date - format: MM-DD-YYYY",
100 response: "JPEG image or JSON error if not found.",
120
121// This is the entry point for HTTP vals
122export default app.fetch;

Glancerresets2 matches

@bradnoble•Updated 2 weeks ago
16 const lastRunAt = new Date(lastRun?.date);
17 const content = lastRun?.content;
18 const fetchURL = [
19 "https://" + subdomain + ".val.run",
20 lastRun?.path,
42 // (note the x-blob-key header)
43 if (content != "default" && diffInMinutes > .5) {
44 const response = await fetch(fetchURL, {
45 method: "POST",
46 headers: {

Glancerhelpers.ts3 matches

@bradnoble•Updated 2 weeks ago
28 const origin = parsedUrl.origin;
29
30 // Fetch the HTML from the URL
31 const response = await fetch(url);
32 const html = await response.text();
33
62
63 // Verify the favicon exists
64 const faviconResponse = await fetch(faviconUrl, { method: "HEAD" });
65
66 if (!faviconResponse.ok) {

practicalAquaWaspmain.tsx2 matches

@stevekrouse•Updated 2 weeks ago
1/** @jsxImportSource https://esm.sh/react */
2import { fetchText } from "https://esm.town/v/stevekrouse/fetchText";
3
4const exampleJSX = <p>Hello, World!</p>;
5
6console.log(
7 await fetchText("https://esm.town/v/moe/HonoReactTailwindStarter@48-deptest/frontend/index.tsx", {
8 headers: {
9 "User-Agent": "", // can't include Deno, which on Val Town it would by default

practicalAquaWaspREADME.md1 match

@stevekrouse•Updated 2 weeks ago
5It doesn't do as much as other transpilers (such as esm.sh, such as rewriting `npm:` imports, etc). We may add that capability in the future. For now, if you want your npm imports to run in the browser, use `https://esm.sh/package` instead of `npm:package`.
6
7The below script demonstrates this transiplation behavior by fetching its own source code (`import.meta.url`) with the user agent of a browser. You can uncoment the line setting the browser agent if you want to see the difference in the output. Or you could just load this val's module URL in your browser to see the untranspiled TS.
8
9As of July 23, 2024, this is the code that determines when esm.town transpiles or not:

filterValsmain.tsx2 matches

@nbbaier•Updated 2 weeks ago
1import { fetchPaginatedData } from "https://esm.town/v/nbbaier/fetchPaginatedData";
2
3export async function filterVals(id: string, filter: (value: any, index: number, array: any[]) => unknown) {
4 const token = Deno.env.get("valtown");
5 const res = await fetchPaginatedData(`https://api.val.town/v1/users/${id}/vals`, {
6 headers: { Authorization: `Bearer ${token}` },
7 });

filterValsmain.tsx2 matches

@dcm31•Updated 2 weeks ago
1import { fetchPaginatedData } from "https://esm.town/v/nbbaier/fetchPaginatedData";
2console.log('hi')
3export async function filterVals(id: string, filter: (value: any, index: number, array: any[]) => unknown) {
4 const token = Deno.env.get("valtown");
5 const res = await fetchPaginatedData(`https://api.val.town/v1/users/${id}/vals`, {
6 headers: { Authorization: `Bearer ${token}` },
7 });

valreadmegeneratormain.tsx1 match

@dcm31•Updated 2 weeks ago
42
43 try {
44 const response = await fetch(`/generate-readme/${user}/${val}`);
45
46 if (!response.ok) {

valreadmegeneratorREADME.md2 matches

@dcm31•Updated 2 weeks ago
29
302. **Generate:**
31 - Click on 'Generate README' and watch as the application swiftly fetches and processes the Val code to create a Markdown README.
32
333. **Copy and Share:**
42- **TailwindCSS:** For styling the application.
43- **Deno:** The server-side environment.
44- **ValTown SDK:** Integrated to fetch Val details.
45- **OpenAI GPT-4:** To generate natural language README content.
46- **JavaScript Modules (ESM):** For seamless module imports.

blob_adminmain.tsx1 match

@recklessreticence•Updated 2 weeks ago
195});
196
197export default lastlogin((request: Request) => app.fetch(request));

fetchPaginatedData2 file matches

@nbbaier•Updated 2 weeks ago

FetchBasic1 file match

@fredmoon•Updated 2 weeks ago