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=336&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 7880 results for "fetch"(564ms)

HTKhanAISearchmain.tsx1 match

@Htkhan6•Updated 2 months ago
218 setResults(null);
219 try {
220 const response = await fetch("/search", {
221 method: "POST",
222 body: JSON.stringify({ query }),

ultimateGraySailfishmain.tsx1 match

@Htkhan5•Updated 2 months ago
48
49 try {
50 const response = await fetch('/search', {
51 method: 'POST',
52 headers: {

statusmonitor2 matches

@brie•Updated 2 months ago
17
18 try {
19 res = await fetch(url);
20 end = performance.now();
21 status = res.status;
30 } catch (e) {
31 end = performance.now();
32 reason = `couldn't fetch: ${e}`;
33 ok = false;
34 }

uptimeCheckmain.tsx1 match

@stevekrouse•Updated 2 months ago
5 let ok = true;
6 try {
7 const res = await fetch(url);
8 if (res.status === 200) {
9 console.log(`Website up (${url})`);

uptimeCheckmain.tsx1 match

@stevekrouse•Updated 2 months ago
5 let ok = true;
6 try {
7 const res = await fetch(url);
8 if (res.status === 200) {
9 console.log(`Website up (${url})`);
status

statusmonitor2 matches

@stevekrouse•Updated 2 months ago
15 const start = performance.now();
16 try {
17 res = await fetch(url);
18 end = performance.now();
19 status = res.status;
25 } catch (e) {
26 end = performance.now();
27 reason = `couldn't fetch: ${e}`;
28 ok = false;
29 }

gamesOfAdventuremain.tsx7 matches

@Spotlight_9•Updated 2 months ago
41 };
42
43 const fetchWeather = async () => {
44 if (!location) return;
45
50 try {
51 // Geocoding to get lat/lon
52 const geoResponse = await fetch(`https://geocoding-api.open-meteo.com/v1/search?name=${encodeURIComponent(location)}&count=1&language=en&format=json`);
53 const geoData = await geoResponse.json();
54
60
61 // Current weather and 7-day forecast
62 const weatherResponse = await fetch(`https://api.open-meteo.com/v1/forecast?latitude=${latitude}&longitude=${longitude}&current_weather=true&hourly=temperature_2m,relativehumidity_2m,windspeed_10m&daily=weathercode,temperature_2m_max,temperature_2m_min&timezone=auto&forecast_days=7`);
63 const weatherData = await weatherResponse.json();
64
89 const handleKeyPress = (e) => {
90 if (e.key === 'Enter') {
91 fetchWeather();
92 }
93 };
109 };
110
111 const response = await fetch('https://jsonbin.org/create', {
112 method: 'POST',
113 headers: {
156 className="location-input"
157 />
158 <button onClick={fetchWeather} className="search-button">
159 Search
160 </button>
161 </div>
162
163 {loading && <div className="loading">Fetching weather...</div>}
164
165 {error && <div className="error">{error}</div>}

ai_pricinggetPricing2 matches

@nbbaier•Updated 2 months ago
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=45";
2import { type ModelCapabilities } from "./types";
3
4const url = "https://raw.githubusercontent.com/BerriAI/litellm/refs/heads/main/model_prices_and_context_window.json";
5const res: { [key: string]: ModelCapabilities } = await fetchJSON(url);
6const pricing = Object.fromEntries(
7 Object.entries(res).filter(([_, obj]) =>

ai_pricinggetUsage2 matches

@nbbaier•Updated 2 months ago
1import { fetchOpenAiUsageData } from "https://esm.town/v/nbbaier/fetchOpenAiUsageData";
2import { DateTime } from "npm:luxon";
3import { TextData } from "./types";
8const month = date.setZone(timeZone).toFormat("LLLL").toLowerCase();
9
10const { data }: { data: TextData[] } = await fetchOpenAiUsageData(today);
11
12function removeNullValues<T extends Record<string, any>>(obj: T): Partial<T> {

Tanveer_AI_Assistant_Appmain.tsx1 match

@Tanveer•Updated 2 months ago
26
27 try {
28 const response = await fetch("/chat", {
29 method: "POST",
30 headers: { "Content-Type": "application/json" },

fetchPaginatedData2 file matches

@nbbaier•Updated 1 week ago

FetchBasic1 file match

@fredmoon•Updated 1 week ago