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=460&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 7867 results for "fetch"(752ms)

properIvoryPikemain.tsx2 matches

@CoachCompanion•Updated 5 months ago
51 setTrainingPlan("");
52 setYoutubeLinks([]);
53 const response = await fetch("/generate-training", {
54 method: "POST",
55 headers: { "Content-Type": "application/json", "Regenerate-Key": regenerateKey.toString() },
76 setSharing(true);
77 try {
78 const response = await fetch("/share-training", {
79 method: "POST",
80 headers: { "Content-Type": "application/json" },

yuktiVoiceAssistantmain.tsx1 match

@Aditya230•Updated 5 months ago
46
47 try {
48 const response = await fetch(mode === 'chat' ? '/chat' : '/generate-image', {
49 method: 'POST',
50 body: JSON.stringify({

PaintSeqmain.tsx6 matches

@youkq95•Updated 5 months ago
233 const textAreaRef = useRef(null);
234
235 const fetchUniprotSequence = async () => {
236 if (!uniprotId.trim()) {
237 setError("Please enter a UniProt ID");
242 setError("");
243 setIsLoading(true);
244 const response = await fetch(`https://rest.uniprot.org/uniprotkb/${uniprotId}.fasta`);
245
246 if (!response.ok) {
254 setSequence(extractedSequence);
255 } catch (error) {
256 console.error("Error fetching UniProt sequence:", error);
257 setError(`Could not retrieve sequence for ${uniprotId}. Check UniProt ID.`);
258 } finally {
407 <div style={{ display: "flex", gap: "10px" }}>
408 <button
409 onClick={fetchUniprotSequence}
410 disabled={isLoading}
411 style={{ flex: 1 }}
412 >
413 {isLoading ? "Fetching..." : "Fetch Sequence"}
414 </button>
415 <select
540 {sequence ? renderSequence() : (
541 <p style={{ color: "#888" }}>
542 Enter or fetch a protein sequence to visualize
543 </p>
544 )}

fantasticPinkCougarmain.tsx4 matches

@Aditya230•Updated 5 months ago
9
10 useEffect(() => {
11 async function fetchWeather() {
12 try {
13 const response = await fetch(
14 `https://api.open-meteo.com/v1/forecast?latitude=${location.latitude}&longitude=${location.longitude}&current_weather=true&hourly=temperature_2m,relativehumidity_2m,windspeed_10m`
15 );
17 setWeatherData(data);
18 } catch (err) {
19 setError("Could not fetch weather data");
20 }
21 }
22
23 fetchWeather();
24 }, [location]);
25

doAppmain.tsx9 matches

@Aditya230•Updated 5 months ago
8
9 useEffect(() => {
10 fetchTodos();
11 }, []);
12
13 async function fetchTodos() {
14 const response = await fetch("/todos");
15 const data = await response.json();
16 setTodos(data);
21 if (!newTodo.trim()) return;
22
23 const response = await fetch("/todos", {
24 method: "POST",
25 headers: { "Content-Type": "application/json" },
28
29 if (response.ok) {
30 await fetchTodos();
31 setNewTodo("");
32 }
34
35 async function toggleTodo(id: number, completed: boolean) {
36 const response = await fetch(`/todos/${id}`, {
37 method: "PATCH",
38 headers: { "Content-Type": "application/json" },
41
42 if (response.ok) {
43 await fetchTodos();
44 }
45 }
46
47 async function deleteTodo(id: number) {
48 const response = await fetch(`/todos/${id}`, {
49 method: "DELETE"
50 });
51
52 if (response.ok) {
53 await fetchTodos();
54 }
55 }

dreamyYellowFleamain.tsx4 matches

@manueltorres0•Updated 5 months ago
1import { email } from "https://esm.town/v/std/email?v=9";
2
3// Fetches a random joke.
4async function fetchRandomJoke() {
5 const response = await fetch(
6 "https://official-joke-api.appspot.com/random_joke",
7 );
9}
10
11const randomJoke = await fetchRandomJoke();
12const setup = randomJoke.setup;
13const punchline = randomJoke.punchline;

discordWebhookWeatherHydmain.tsx3 matches

@boson•Updated 5 months ago
1import { discordWebhook } from "https://esm.town/v/stevekrouse/discordWebhook";
2import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=41";
3import process from "node:process";
4
6let output = "**Hyderabad Weather Report**\n\n";
7const accuweatherCityCode = "202190";
8// fetch JSON daily from accuweather
9const getForecast = async () => {
10 const forecastData = await fetchJSON(
11 `http://dataservice.accuweather.com/forecasts/v1/daily/1day/${accuweatherCityCode}?apikey=${process.env.accuWeather}&details=true&metric=true`,
12 );

searchSectorsAppmain.tsx6 matches

@Fairestofthemall•Updated 5 months ago
29 const [error, setError] = useState(null);
30
31 // Fetch businesses from server
32 const fetchBusinesses = async () => {
33 setIsLoading(true);
34 setError(null);
35
36 try {
37 const response = await fetch(`/api/search?postcode=${postcode}&sector=${sector}`);
38
39 if (!response.ok) {
53 // Manual search function
54 const handleManualSearch = () => {
55 fetchBusinesses();
56 };
57
260 try {
261 // Use a business directory API (Replace with actual API)
262 const apiResponse = await fetch(`https://api.example.com/businesses?postcode=${postcode}&sector=${sector}`, {
263 headers: {
264 'Authorization': `Bearer ${API_KEY}`,
268
269 if (!apiResponse.ok) {
270 throw new Error('Failed to fetch businesses');
271 }
272

dns_record_debuggerREADME.md2 matches

@stevekrouse•Updated 5 months ago
3Proxied web browser for debugging new DNS records
4
5It's difficult to verify new DNS records. If you check too early, the old records may get cached on your computer, browser, or local network. This tool uses a proxied fetch so you can always view your web page uncached.
6
7Uses @std/fetch on the backend to ensure the DNS records of the request are from new places every request.
8
9Version 4 of this val also showed DNS records, pulled on the server,

big5PersonalityTestmain.tsx6 matches

@manyone•Updated 5 months ago
17 ];
18
19 // Endpoint to fetch questions
20 if (new URL(request.url).pathname === '/questions') {
21 return new Response(JSON.stringify(defaultQuestions), {
284
285 function completeQuiz() {
286 fetch('/submit', {
287 method: 'POST',
288 headers: { 'Content-Type': 'application/json' },
358
359 startButton.addEventListener('click', function() {
360 // Use absolute URL for fetching questions
361 fetch(window.location.origin + '/questions')
362 .then(function(response) {
363 console.log('Fetch response status:', response.status);
364 if (!response.ok) {
365 throw new Error('Network response was not ok');
375 })
376 .catch(function(error) {
377 logError('Error fetching questions', error);
378 });
379 });

fetchPaginatedData2 file matches

@nbbaier•Updated 1 week ago

FetchBasic1 file match

@fredmoon•Updated 1 week ago