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/$%7Bart_info.art.src%7D?q=fetch&page=1016&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 14468 results for "fetch"(10065ms)

sqlite_adminmain.tsx1 match

@genco•Updated 4 months ago
10app.get("/", async (c) => c.html(await sqlite_admin_tables()));
11app.get("/:table", async (c) => c.html(await sqlite_admin_table(c.req.param("table"))));
12export default basicAuth(app.fetch, { verifyUser: (_, password) => verifyToken(password) });

getLemmyJwtmain.tsx1 match

@AIWB•Updated 4 months ago
7 const { LemmyHttp } = await import("npm:lemmy-js-client@0.18.1");
8 let client = new LemmyHttp(`https://${instance}`, {
9 fetchFunction: fetch,
10 });
11 try {

API_URLmain.tsx4 matches

@awhitter•Updated 4 months ago
102}
103
104// Val Town HTTP Endpoint for Airtable → Framer Fetch
105export default async function (req: Request): Promise<Response> {
106 // Setup CORS Headers for Framer Fetch compatibility
107 const headers = new Headers({
108 "Access-Control-Allow-Origin": "*",
123 const airtableTableId = await val.secrets.AIRTABLE_TABLE_ID;
124
125 // Fetch all records with pagination
126 let allRecords: AirtableRecord[] = [];
127 let offset: string | undefined;
133 }
134
135 const airtableResp = await fetch(url.toString(), {
136 headers: {
137 Authorization: `Bearer ${airtableApiKey}`,

codeOnValTownmain.tsx3 matches

@AIWB•Updated 4 months ago
37
38/**
39 * @param handler Fetch handler
40 * @param val Define which val should open
41 */
42export function modifyFetchHandler(
43 handler: (req: Request) => Response | Promise<Response>,
44 { val, style }: { val?: ValRef; style?: string } = {},
52}
53
54export default modifyFetchHandler;

codeOnValTownREADME.md6 matches

@AIWB•Updated 4 months ago
11Here are 2 different ways to add the "Code on Val Town" ribbon:
12
13### 1. Wrap your fetch handler (recommended)
14
15```ts
16import { modifyFetchHandler } from "https://esm.town/v/andreterron/codeOnValTown?v=50";
17import { html } from "https://esm.town/v/stevekrouse/html?v=5";
18
19export default modifyFetchHandler(async (req: Request): Promise<Response> => {
20 return html(`<h2>Hello world!</h2>`);
21});
51These functions infer the val using the call stack or the request URL. If the inference isn't working, or if you want to ensure it links to a specific val, pass the `val` argument:
52
53- `modifyFetchHandler(handler, {val: { handle: "andre", name: "foo" }})`
54- `modifyHtmlString("<html>...", {val: { handle: "andre", name: "foo" }})`
55
58You can set the style parameter to a css string to customize the ribbon. Check out [github-fork-ribbon-css](https://github.com/simonwhitaker/github-fork-ribbon-css?tab=readme-ov-file#styling) to learn more about how to style the element.
59
60- `modifyFetchHandler(handler, {style: ".github-fork-ribbon:before { background-color: #333; }"})`
61- `modifyHtmlString("<html>...", {style: ".github-fork-ribbon:before { background-color: #333; }"})`
62
64
65```ts
66modifyFetchHandler(handler, {style: `@media (max-width: 768px) {
67 .github-fork-ribbon {
68 display: none !important;

contentTemplateAppmain.tsx19 matches

@awhitter•Updated 4 months ago
53
54 useEffect(() => {
55 fetchContent();
56 }, []);
57
58 const fetchContent = async () => {
59 try {
60 const response = await fetch("/api/content");
61 const data = await response.json();
62 if (data.records) {
63 setContent(data.records);
64 } else {
65 throw new Error("Failed to fetch content");
66 }
67 setLoading(false);
68 } catch (error) {
69 console.error("Error fetching content:", error);
70 setLoading(false);
71 }
99 const analyzeContent = async (item: AirtableRecord) => {
100 try {
101 const response = await fetch("/api/analyze", {
102 method: "POST",
103 headers: {
260
261 try {
262 const response = await fetch(airtableUrl, {
263 headers: {
264 'Authorization': `Bearer ${apiToken}`,
274 return new Response(JSON.stringify(data), { headers });
275 } catch (error) {
276 console.error("Error fetching Airtable data:", error);
277 return new Response(JSON.stringify({ error: "Error fetching data from Airtable" }), {
278 status: 500,
279 headers
368// Example 2: Making an API call to /api/content endpoint
369/*
370async function fetchContent() {
371 try {
372 const response = await fetch('https://awhitter-contenttemplateapp.web.val.run/api/content');
373 const data = await response.json();
374 console.log('Content:', data);
375 // Process the data as needed
376 } catch (error) {
377 console.error('Error fetching content:', error);
378 }
379}
380
381fetchContent();
382*/
383
427*/
428
429// Example 5: Using the endpoint in Framer with fetch
430/*
431// In your Framer project, create a new code component and use the following code:
433import { Data, animate, Override, Animatable } from "framer"
434
435// This function fetches the content from the API
436async function fetchContent() {
437 try {
438 const response = await fetch('https://awhitter-contenttemplateapp.web.val.run/api/content')
439 const data = await response.json()
440 return data.records
441 } catch (error) {
442 console.error('Error fetching content:', error)
443 return []
444 }
450
451 Data.useEffect(() => {
452 fetchContent().then(setContent)
453 }, [])
454

aimain.tsx3 matches

@goode_bye•Updated 4 months ago
694
695 // just launch it, don't wait for the result
696 // const taskRunResponse = await fetch(`${URL}/taskrun`, {
697 const taskRunResponse = fetch(`${URL}/taskrun`, {
698 method: "POST",
699 headers: {
785}
786
787export default app.fetch;
788export { ai, ModelProvider, modelProvider, test };

aiREADME.md1 match

@goode_bye•Updated 4 months ago
12
13 try {
14 const response = await fetch(url);
15 const data = await response.json();
16 return data;

API_URLREADME.md1 match

@awhitter•Updated 4 months ago
8import { API_URL } from "https://esm.town/v/std/API_URL";
9
10const response = await fetch(`${API_URL}/v1/me`, {
11 headers: {
12 Authorization: `Bearer ${Deno.env.get("valtown")}`,

sqlitemain.tsx2 matches

@awhitter•Updated 4 months ago
35
36async function execute(statement: InStatement): Promise<ResultSet> {
37 const res = await fetch(`${API_URL}/v1/sqlite/execute`, {
38 method: "POST",
39 headers: {
49
50async function batch(statements: InStatement[], mode?: TransactionMode): Promise<ResultSet[]> {
51 const res = await fetch(`${API_URL}/v1/sqlite/batch`, {
52 method: "POST",
53 headers: {

testWeatherFetcher1 file match

@sjaskeprut•Updated 1 day ago

weatherFetcher1 file match

@sjaskeprut•Updated 1 day ago