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/$2?q=fetch&page=1&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 10673 results for "fetch"(710ms)

untitled-923index.ts1 match

@Piyush1234Updated 1 hour ago
78
79// This is the entry point for HTTP vals
80export default app.fetch;

cp24-digestrenderHtml.tsx2 matches

@gwoods22Updated 1 hour ago
1/** @jsxImportSource https://esm.sh/hono@4.0.8/jsx **/
2import { modifyFetchHandler } from "https://esm.town/v/andreterron/codeOnValTown?v=50";
3import { Hono } from "npm:hono@4.0.8";
4import { jsxRenderer } from "npm:hono@4.0.8/jsx-renderer";
34
35// Add's the valtown ribbon in corner
36export default modifyFetchHandler(app.fetch);

charmaineValSearchcomponents.tsx2 matches

@charmaineUpdated 1 hour ago
1221 <h3>Try searching for:</h3>
1222 <div className="search-examples">
1223 <a href="?q=fetch" className="example-link">fetch</a>
1224 <a href="?q=api" className="example-link">api</a>
1225 <a href="?q=database" className="example-link">database</a>
1375 <h3>Try searching for:</h3>
1376 <div className="search-examples">
1377 <a href="?q=fetch" className="example-link">fetch</a>
1378 <a href="?q=api" className="example-link">api</a>
1379 <a href="?q=database" className="example-link">database</a>

GitHubSyncREADME.md4 matches

@johnnyclemUpdated 2 hours ago
12
13- `/push` will copy the contents from a list of vals specified in `config.json` and push them to a GitHub repo
14- `/deploy` is a GitHub webhook URL that will fetch contents from GitHub and update the code on Val Town
15
161. Fork this val
271. Add a `VAL_SECRET` env var to the val. Use this secret to sign the webhook POST request to the `/push` endpoint. Use this endpoint to commit vals from Val Town to your GitHub repo.
28
29### Example push to GitHub fetch
30
31You can use this example to POST to the `/push` endpoint to copy vals to GitHub.
46 const signature = await sign(body, secret);
47
48 const res = await fetch(url, {
49 method: "POST",
50 body,
89- [x] Monkey test
90- [x] Add setup instructions to readme
91- [x] Add example code for private webhook fetch
92- [x] Make val and repo public
93- [ ] Check modified date before export to GitHub??

GitHubSyncindex1 match

@johnnyclemUpdated 2 hours ago
22app.post("/deploy", verifyGitHubSignature(GITHUB_WEBHOOK_SECRET), deploy);
23
24export default app.fetch;

dailySlackRoundupmain.tsx2 matches

@johnnyclemUpdated 2 hours ago
1import { fetch } from "https://esm.town/v/std/fetch";
2import { getDayName } from "https://esm.town/v/stevekrouse/getDayName?v=2";
3import process from "node:process";
4
5export const dailySlackRoundup = async () => {
6 const res = await fetch(process.env.BRAINBOT_WEBHOOK_URL, {
7 method: "POST",
8 body: JSON.stringify({

templateTwitterAlertmain.tsx1 match

@johnnyclemUpdated 2 hours ago
20 : Math.floor((Date.now() - 2 * 24 * 60 * 60 * 1000) / 1000);
21
22 // Fetch and log tweets
23 const response = await socialDataSearch(`${query} since_time:${timeFrame}`);
24 console.log("Response from socialDataSearch:", response);

LiveStormMCPmcp.ts4 matches

@supagroovaUpdated 2 hours ago
1import { McpServer, ResourceTemplate } from "npm:@modelcontextprotocol/sdk/server/mcp.js";
2import { extractGetEndpoints, extractMutationEndpoints, fetchOpenApiSpec, proxyRequest } from "./livestorm.ts";
3import { z } from "npm:zod";
4import type { OperationObject, SchemaObject } from "./types.ts";
38
39 try {
40 console.log("Fetching Livestorm API OpenAPI spec...");
41 // Fetch the OpenAPI spec
42 const openApiSpec = await fetchOpenApiSpec();
43
44 // Extract GET endpoints (Resources)

nightbot-master-commandnew-file-9775.tsx36 matches

@jaydenUpdated 2 hours ago
1import { fetch } from "https://esm.town/v/std/fetch";
2import { sqlite } from "https://esm.town/v/std/sqlite";
3// import randomPokemon from "jsr:random-pokemon";
22 console.log("handler.weather args=", args);
23 const location = encodeURIComponent(args.join(" "));
24 const res = await fetch(`https://wttr.in/${location}?format=%l:+%c+%t`);
25 if (!res.ok) {
26 console.error("weather fetch failed", res.status);
27 return `❌ Unable to fetch weather for "${args.join(" ")}"`;
28 }
29 return await res.text();
31 catfact: async () => {
32 console.log("handler.catfact");
33 const res = await fetch("https://catfact.ninja/fact");
34 if (!res.ok) {
35 console.error("catfact fetch failed", res.status);
36 return "❌ Couldn’t fetch a cat fact right now. Try again later!";
37 }
38 const { fact } = await res.json() as { fact: string };
41 advice: async () => {
42 console.log("handler.advice");
43 const res = await fetch("https://api.adviceslip.com/advice");
44 if (!res.ok) {
45 console.error("advice fetch failed", res.status);
46 return "❌ Couldn't fetch advice right now. Try again later!";
47 }
48 const { slip } = await res.json() as { slip: { advice: string } };
52 console.log("handler.dadjoke");
53 // icanhazdadjoke returns one random dad joke per request
54 const res = await fetch("https://icanhazdadjoke.com/", {
55 headers: { Accept: "application/json" },
56 });
57 if (!res.ok) {
58 console.error("dadjoke fetch failed", res.status);
59 return "❌ Couldn't fetch a joke right now. Try again later!";
60 }
61 const { joke } = await res.json() as { joke: string };
64 trivia: async () => {
65 console.log("handler.trivia");
66 const res = await fetch("http://numbersapi.com/random/trivia?json");
67 if (!res.ok) {
68 console.error("trivia fetch failed", res.status);
69 return "❌ Couldn't fetch trivia right now. Try again later!";
70 }
71 const { text, number } = await res.json() as { text: string; number: number };
74 compliment: async () => {
75 console.log("handler.compliment");
76 const res = await fetch("https://complimentr.com/api");
77 if (!res.ok) {
78 console.error("compliment fetch failed", res.status);
79 return "❌ Couldn't fetch a compliment right now. Try again later!";
80 }
81 const { compliment } = await res.json() as { compliment: string };
84 insult: async () => {
85 console.log("handler.insult");
86 const res = await fetch("https://evilinsult.com/generate_insult.php?lang=en&type=json");
87 if (!res.ok) {
88 console.error("insult fetch failed", res.status);
89 return "❌ Couldn't fetch an insult right now. Try again later!";
90 }
91 const { insult } = await res.json() as { insult: string };
215
216 try {
217 const res = await fetch(`https://ohmanda.com/api/horoscope/${sign}`);
218 if (!res.ok) {
219 console.error("horoscope fetch failed", res.status);
220 return "❌ Couldn't fetch horoscope. Try again later!";
221 }
222 const { horoscope } = await res.json() as { horoscope: string };
223 return `🔮 ${sign.charAt(0).toUpperCase() + sign.slice(1)}: ${horoscope}`;
224 } catch {
225 return "❌ Something went wrong fetching your stars!";
226 }
227 },
232 // return `🧬 Your Pokémon is: ${name.charAt(0).toUpperCase() + name.slice(1)}`;
233 // } catch {
234 // return "❌ Couldn't fetch a Pokémon!";
235 // }
236 // },
348 setTimeout(async () => {
349 try {
350 await fetch(responseUrl, {
351 method: "POST",
352 headers: { "Content-Type": "application/json" },
376 setTimeout(async () => {
377 try {
378 await fetch(responseUrl, {
379 method: "POST",
380 headers: { "Content-Type": "application/json" },
407 // }
408
409 // fetch one random chatter
410 let favorite: string;
411 try {
412 const res = await fetch(
413 `https://commands.garretcharp.com/twitch/chatter/vevisk?count=1&moderatorId=106247697`,
414 );
419 favorite = chatters[0]; // only one requested
420 } catch (err) {
421 console.error("favorite fetch failed", err);
422 return new Response("❌ Couldn't pick a favorite viewer right now.", {
423 headers: { "Content-Type": "text/plain" },
430 const drumroll = setTimeout(async () => {
431 try {
432 await fetch(responseUrl, {
433 method: "POST",
434 headers: { "Content-Type": "application/json" },
442 const reveal = setTimeout(async () => {
443 try {
444 await fetch(responseUrl, {
445 method: "POST",
446 headers: { "Content-Type": "application/json" },
473 // setTimeout(async () => {
474 // try {
475 // await fetch(responseUrl, {
476 // method: "POST",
477 // headers: { "Content-Type": "application/json" },
486 setTimeout(async () => {
487 try {
488 await fetch(responseUrl, {
489 method: "POST",
490 headers: { "Content-Type": "application/json" },

LiveStormMCPlivestorm.ts8 matches

@supagroovaUpdated 2 hours ago
12
13/**
14 * Fetches the Livestorm API OpenAPI definition
15 */
16export async function fetchOpenApiSpec(): Promise<OpenApiSchema> {
17 try {
18 // Check if the OpenAPI spec is cached in Blob storage
23 } catch (e) {
24 if (e instanceof ValTownBlobNotFoundError) {
25 console.log(`Fetching OpenAPI spec from ${LIVESTORM_API_SPEC_URL}...`);
26 response = await fetch(LIVESTORM_API_SPEC_URL);
27 if (!response.ok) {
28 const errorText = await response.text();
29 console.error(`Failed to fetch OpenAPI spec: ${response.status} ${response.statusText}`);
30 console.error(`Response body: ${errorText}`);
31 throw new Error(`Failed to fetch OpenAPI spec: ${response.status} ${response.statusText}`);
32 }
33 } else {
56 }
57 } catch (error) {
58 console.error('Error fetching OpenAPI spec:', error);
59 throw error;
60 }
181 try {
182 // Make the request to Livestorm API
183 const response = await fetch(url, requestOptions);
184
185 // Return the response

FRAMERFetchBasic1 file match

@bresnikUpdated 7 hours ago

FetchBasic1 file match

@bresnikUpdated 7 hours ago