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/$%7Bsuccess?q=fetch&page=656&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 9045 results for "fetch"(2357ms)

DailyDaughterNotesmain.tsx5 matches

@heathergliffin•Updated 8 months ago
14
15 useEffect(() => {
16 fetchTodayNote();
17 }, []);
18
19 const fetchTodayNote = async () => {
20 setLoading(true);
21 const response = await fetch("/get-note");
22 const data = await response.json();
23 setNote(data.note);
27 const generateNewNote = async () => {
28 setLoading(true);
29 await fetch("/generate-note", { method: "POST" });
30 await fetchTodayNote();
31 };
32

eldestBronzePtarmiganmain.tsx7 matches

@ejfox•Updated 8 months ago
16
17 useEffect(() => {
18 fetchUser();
19 fetchMatches();
20 }, []);
21
22 const fetchUser = async () => {
23 const response = await fetch('/user');
24 if (response.ok) {
25 const userData = await response.json();
30 };
31
32 const fetchMatches = async () => {
33 const response = await fetch('/matches');
34 if (response.ok) {
35 const matchesData = await response.json();
44 formData.append('type', type);
45
46 const response = await fetch('/upload', {
47 method: 'POST',
48 body: formData,

WikiImagemain.tsx6 matches

@ampp•Updated 8 months ago
13}
14
15export const fetchWikipediaImage = async (request: Request): Promise<Response> => {
16 const url = new URL(request.url);
17 const pageName = url.searchParams.get("title");
30 return formatResponse(pageData, format);
31 } catch (error) {
32 console.error("Error fetching Wikipedia image:", error);
33 return new Response("An error occurred while fetching the image", { status: 500 });
34 }
35};
44 apiUrl.searchParams.append("format", "json");
45
46 const response = await fetch(apiUrl.toString());
47 const data = await response.json();
48
73 apiUrl.searchParams.append("format", "json");
74
75 const response = await fetch(apiUrl.toString());
76 const data = await response.json();
77
141 apiUrl.searchParams.append("format", "json");
142
143 const response = await fetch(apiUrl.toString());
144 const data = await response.json();
145

lucia_middlewaremain.tsx1 match

@stevekrouse•Updated 8 months ago
212 return response;
213 });
214 return app.fetch;
215};

twitchmain.tsx1 match

@pinjasaur•Updated 9 months ago
1const getText = async url => (await fetch(url)).text();
2
3export default async function(req: Request): Promise<Response> {

YouTubeSubmissionsmain.tsx2 matches

@mvmattgray•Updated 9 months ago
2// We'll use the built-in Request and Response objects for handling HTTP.
3// The form fields are customized for video information collection.
4// We'll add JSON API endpoints for Framer Fetch integration.
5
6import { blob } from "https://esm.town/v/std/blob";
11 const url = new URL(req.url);
12
13 // API endpoints for Framer Fetch
14 if (url.pathname === "/api/entries") {
15 if (req.method === "GET") {

getWeatherForecastmain.tsx2 matches

@cjpais•Updated 9 months ago
13
14 try {
15 const weatherResponse = await fetch(weatherApiUrl);
16 if (!weatherResponse.ok) {
17 throw new Error(`Weather API request failed with status: ${weatherResponse.status}`);
33 });
34 } catch (err) {
35 return new Response("Error fetching weather data: " + err.message, {
36 status: 500, // Internal Server Error
37 headers: { "Content-Type": "text/plain" },

multirouteHonomain.tsx1 match

@vawogbemi•Updated 9 months ago
138app.notFound((c) => c.render(<NotFoundPage />));
139
140export default app.fetch;

dialogmain.tsx3 matches

@jdan•Updated 9 months ago
266 {
267 name: "MS Sans Serif",
268 data: await fetch("https://esm.sh/98.css@0.1.20/fonts/converted/ms_sans_serif.woff").then(res =>
269 res.arrayBuffer()
270 ),
274 {
275 name: "MS Sans Serif",
276 data: await fetch("https://esm.sh/98.css@0.1.20/fonts/converted/ms_sans_serif_bold.woff").then(res =>
277 res.arrayBuffer()
278 ),
289});
290
291export default app.fetch;

violetKoalamain.tsx5 matches

@void•Updated 9 months ago
1async function fetchWeather() {
2 const API_KEY = "439d4b804bc8187953eb36d2a8c26a02"; // Example key, replace with your own
3 const LAT = 51.5074; // London latitude
6 `https://api.openweathermap.org/data/2.5/onecall?lat=${LAT}&lon=${LON}&exclude=hourly,daily&units=metric&appid=${API_KEY}`;
7
8 console.log("Fetching weather from URL:", url); // Log the full URL
9
10 try {
11 const response = await fetch(url);
12
13 if (!response.ok) {
17 return await response.json();
18 } catch (error) {
19 console.error("Error fetching weather data:", error);
20 return null;
21 }
62
63export default async function main(req) {
64 const weather = await fetchWeather();
65 const url = `http://api.openweathermap.org/data/2.5/forecast/daily?q=London&appid=439d4b804bc8187953eb36d2a8c26a02`;
66 const html = generateHTML(weather, url);

TAC_FetchBasic2 file matches

@A7_OMC•Updated 12 hours ago

hn-fetch1 file match

@matija•Updated 14 hours ago