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=181&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 4661 results for "fetch"(386ms)

newestindex.tsx5 matches

@loadingโ€ขUpdated 3 weeks ago
11 const limit = 20;
12
13 const fetchVals = async (offset) => {
14 try {
15 setLoading(true);
16 const response = await fetch(`/api/vals?limit=${limit}&offset=${offset}`);
17
18 if (!response.ok) {
19 throw new Error(`Failed to fetch vals: ${response.status}`);
20 }
21
24 setError(null);
25 } catch (err) {
26 console.error("Error fetching vals:", err);
27 setError("Failed to load vals. Please try again later.");
28 } finally {
32
33 React.useEffect(() => {
34 fetchVals(page * limit);
35 }, [page]);
36

reverseProxymod.ts1 match

@maxmโ€ขUpdated 3 weeks ago
4 return async (req: Request): Promise<Response> => {
5 const url = new URL(target, req.url);
6 return fetch(url, req);
7 };
8}

bloglive-reload.ts3 matches

@valdottownโ€ขUpdated 3 weeks ago
32
33/**
34 * Creates a wrapper around a fetch handler that injects a script tag into HTML responses
35 *
36 * @param handler The original fetch handler function
37 * @param scriptContent The HTML content to inject
38 * @returns A new fetch handler with HTML rewriting capability
39 */
40export function injectHTML(

accurateIvoryElkmain.tsx4 matches

@vthopcherneniโ€ขUpdated 3 weeks ago
1// Joke Generator Val
2
3// Async function to fetch joke and simulate sending an email
4async function jokeGeneratorVal() {
5 try {
6 // 1. Fetch a random joke
7 const response = await fetch("https://official-joke-api.appspot.com/random_joke");
8 const joke = await response.json();
9
16 console.log(`Body: ${setup} โ€” ${punchline}`);
17 } catch (error) {
18 console.error("Failed to fetch or send joke:", error);
19 }
20}

newestREADME.md3 matches

@loadingโ€ขUpdated 3 weeks ago
1# Latest Vals on Val Town
2
3This project displays the latest public vals (projects) on Val Town. It uses the Val Town API to fetch the latest vals and displays them in a clean, responsive interface.
4
5## Features
21```
22โ”œโ”€โ”€ backend/
23โ”‚ โ””โ”€โ”€ index.ts # API endpoint to fetch vals
24โ”œโ”€โ”€ frontend/
25โ”‚ โ”œโ”€โ”€ components/
36## How It Works
37
381. The backend API endpoint fetches the latest vals from Val Town's API
392. The frontend displays these vals in a responsive grid layout
403. Users can navigate through pages of vals using the pagination controls

cerebras_coderindex1 match

@GARESโ€ขUpdated 3 weeks ago
5async function servePublicFile(path: string): Promise<Response> {
6 const url = new URL("./public/" + path, import.meta.url);
7 const text = await (await fetch(url, {
8 headers: {
9 "User-Agent": "", // to transpile TS to JS

cerebras_coderindex1 match

@GARESโ€ขUpdated 3 weeks ago
181
182 try {
183 const response = await fetch("/", {
184 method: "POST",
185 body: JSON.stringify({

fixItWanduseAuth.ts4 matches

@wolfโ€ขUpdated 3 weeks ago
33
34 try {
35 const response = await fetch("/auth/me", {
36 credentials: "include",
37 headers: {
72
73 try {
74 const response = await fetch("/auth/request-magic-link", {
75 method: "POST",
76 headers: { "Content-Type": "application/json" },
101
102 try {
103 const response = await fetch("/auth/logout", {
104 method: "POST",
105 credentials: "include",
147
148 try {
149 const response = await fetch("/auth/me", {
150 method: "PUT",
151 credentials: "include",

gpt_memorymain.tsx9 matches

@toowiredโ€ขUpdated 3 weeks ago
11
12 useEffect(() => {
13 fetchMemories();
14 }, []);
15
16 const fetchMemories = async () => {
17 const response = await fetch('/memory');
18 if (response.ok) {
19 const data = await response.json();
20 setMemories(data.memories);
21 } else {
22 console.error('Failed to fetch memories');
23 }
24 };
26 const handleAddMemory = async (e) => {
27 e.preventDefault();
28 const response = await fetch('/memory', {
29 method: 'POST',
30 headers: {
35 if (response.ok) {
36 setNewMemory({ name: '', description: '', summary: '', reason: '' });
37 fetchMemories();
38 } else {
39 console.error('Failed to add memory');
42
43 const handleDeleteMemory = async (id) => {
44 const response = await fetch(`/memory/${id}`, {
45 method: 'DELETE',
46 });
47 if (response.ok) {
48 fetchMemories();
49 } else {
50 console.error('Failed to delete memory');
222
223export default async function server(req: Request): Promise<Response> {
224 return app.fetch(req);
225}
226

Kaliapi3 matches

@augustohpโ€ขUpdated 3 weeks ago
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON";
2
3export default async function difyApi(
26 }
27 console.log(url.toString(), options);
28 const res = await fetchJSON(url.toString(), options);
29
30 return res;
53
54 const uploadUrl = "https://api.dify.ai/v1/files/upload";
55 const uploadResponse = await fetch(uploadUrl, {
56 method: "POST",
57 headers: {

fetchPaginatedData2 file matches

@nbbaierโ€ขUpdated 1 week ago

tweetFetcher2 file matches

@nbbaierโ€ขUpdated 1 week ago