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=548&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"(1232ms)

distinctGoldLarkmain.tsx2 matches

@tempguy•Updated 9 months ago
13const apiUrl = "https://filehaus.top/api/upload/data.json"; // Replace with your API URL
14
15// Send the file using fetch
16try {
17 const response = await fetch(apiUrl, {
18 method: "POST",
19 body: formData,

valleGetValsContextWindowmain.tsx8 matches

@janpaul123•Updated 9 months ago
11 }
12
13 const readmeVals: any = await (await fetch("https://janpaul123-readmevals.web.val.run/")).json();
14
15 const API_URL = "https://api.val.town";
69 );
70 });
71 export default app.fetch;`,
72 },
73 {
129 {
130 prompt: "Write a val that accesses environment variables",
131 code: `const res = await fetch("${API_URL}/v1/me", {
132 headers: {
133 Authorization: \`Bearer \${Deno.env.get("valtown")}\`,
141 code: `import process from "node:process";
142
143 const res = await fetch("${API_URL}/v1/me", {
144 headers: {
145 Authorization: \`Bearer \${process.env.valtown}\`,
165 code: `import cheerio from "npm:cheerio";
166
167 const response = await fetch("https://example.com");
168 const body = await response.text();
169 const $ = cheerio.load(body);
453 {
454 role: "user",
455 content: "Write a val that fetches the weather in Brooklyn, NY",
456 },
457 {
458 role: "assistant",
459 content:
460 "```ts\nexport default async function(req: Request): Promise<Response> {\n const apiKey = Deno.env.get(\"METEO_KEY\");\n const apiUrl = `https://api.open-meteo.com/v1/forecast?latitude=40.6782&longitude=-73.9442&hourly=temperature_2m&current_weather=true&apikey=${apiKey}`;\n\n const response = await fetch(apiUrl);\n const weatherData = await response.json();\n\n return new Response(JSON.stringify(weatherData), { headers: { \"Content-Type\": \"application/json\" } });\n}\n```",
461 },
462 {
467 role: "assistant",
468 content:
469 "```ts\n/** @jsxImportSource npm:hono@3/jsx */\nimport { Hono } from \"npm:hono\";\n\nconst app = new Hono();\napp.get(\"/\", async (c) => {\n return c.html(\n <div>\n <form>\n Your name: <input type=\"text\" name=\"name\" /> <input type=\"submit\" />\n </form>\n Hello {c.req.query(\"name\")}\n </div>,\n );\n});\nexport default app.fetch;\n```",
470 },
471 ...templatePrompts,

githubActivityReportmain.tsx2 matches

@elliotbraem•Updated 9 months ago
14 }
15
16 const response = await fetch(`https://api.github.com/users/${userName}/events`);
17 const events = await response.json();
18
19 if (!events) {
20 return new Response(JSON.stringify({ ok: false, error: "Failed to fetch events" }), {
21 headers: { "Content-Type": "application/json" },
22 status: 500,

switchbotmain.tsx2 matches

@stevekrouse•Updated 9 months ago
29 .toString("base64");
30
31 const response = await fetch(`https://api.switch-bot.com/${path}`, {
32 headers: {
33 "Authorization": token,
155});
156
157export default app.fetch;

switchbotmain.tsx2 matches

@stevekrouse•Updated 9 months ago
29 .toString("base64");
30
31 const response = await fetch(`https://api.switch-bot.com/${path}`, {
32 headers: {
33 "Authorization": token,
155});
156
157export default app.fetch;

bumpyGreenAntelopemain.tsx1 match

@hunty•Updated 9 months ago
10});
11
12export default app.fetch;

bumpyGreenAntelopeREADME.md2 matches

@hunty•Updated 9 months ago
1# Fetch Template
2Example template to quickly get started with a backend for Fetch in Framer.

IsNDRRMCDownmain.tsx2 matches

@rkda•Updated 9 months ago
9 let reason: string;
10 try {
11 const res = await fetch(URL, { redirect: "follow" });
12 if (res.status !== 200) {
13 reason = `(status code: ${res.status})`;
15 }
16 } catch (e) {
17 reason = `couldn't fetch: ${e}`;
18 ok = false;
19 }

bbrunmain.tsx1 match

@dglazkov•Updated 9 months ago
115 const body = await req.json() as { $key: string };
116 body.$key = $key;
117 const response = await fetch(endpointURL, {
118 method: "POST",
119 headers: {

umbrellaRemindermain.tsx2 matches

@nancypants•Updated 9 months ago
1import { email } from "https://esm.town/v/std/email?v=9";
2import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON";
3import { nominatimSearch } from "https://esm.town/v/stevekrouse/nominatimSearch";
4import { weatherGovGrid } from "https://esm.town/v/stevekrouse/weatherGovGrid";
14 lon,
15 });
16 let { properties: { periods } } = await fetchJSON(
17 grid.forecastHourly,
18 );

fetchPaginatedData2 file matches

@nbbaier•Updated 1 week ago

FetchBasic1 file match

@fredmoon•Updated 1 week ago