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=481&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 8288 results for "fetch"(1266ms)

wideApimain.tsx1 match

@maxm•Updated 4 months ago
88export type WideApi = typeof routes;
89
90export default app.fetch.bind(app);

mdxmain.tsx1 match

@pomdtr•Updated 4 months ago
1/** @jsxImportSource https://esm.sh/preact **/
2
3import { modifyFetchHandler } from "https://esm.town/v/andreterron/codeOnValTown?v=50";
4import { api } from "https://esm.town/v/pomdtr/api";
5import { extractValInfo } from "https://esm.town/v/pomdtr/extractValInfo";

reflective_qamain.tsx1 match

@stevekrouse•Updated 4 months ago
145
146 try {
147 const response = await fetch("/ask", {
148 method: "POST",
149 headers: {

GameAwards2024PredictionGamemain.tsx9 matches

@bmitchinson•Updated 4 months ago
12
13 useEffect(() => {
14 fetchData();
15 }, []);
16
17 const fetchData = async () => {
18 try {
19 const response = await fetch("/data");
20 if (!response.ok) {
21 throw new Error("Failed to fetch data");
22 }
23 const { categories, allPredictions } = await response.json();
27 setIsLoading(false);
28 } catch (err) {
29 console.error("Error fetching data:", err);
30 setError(err.message);
31 setIsLoading(false);
183 // Data endpoint
184 if (request.method === "GET" && new URL(request.url).pathname === "/data") {
185 const gistResponse = await fetch(
186 "https://gist.githubusercontent.com/bmitchinson/5c3ed5df80977e402113fc33c149ae7e/raw/ea393f1407d31da96623387299fc6e3702f5fb0a/gameawards_24_backend.json",
187 );
213 const username = segments.pop();
214
215 // Fetch categories
216 const gistResponse = await fetch(
217 "https://gist.githubusercontent.com/bmitchinson/5c3ed5df80977e402113fc33c149ae7e/raw/ea393f1407d31da96623387299fc6e3702f5fb0a/gameawards_24_backend.json",
218 );
219 const categories = await gistResponse.json();
220
221 // Fetch this user's predictions
222 const userResult = await sqlite.execute(
223 `SELECT predictions FROM ${KEY}_predictions_${SCHEMA_VERSION} WHERE username = ?`,

cerebras_codermain.tsx4 matches

@nn6n•Updated 4 months ago
36
37 useEffect(() => {
38 async function fetchStats() {
39 const response = await fetch("/dashboard-stats");
40 const data = await response.json();
41 setStats(data);
42 }
43 fetchStats();
44 }, []);
45
146
147 try {
148 const response = await fetch("/", {
149 method: "POST",
150 body: JSON.stringify({

dedicatedAmethystLeopardmain.tsx5 matches

@mohsen•Updated 4 months ago
14
15 useEffect(() => {
16 fetchStocks();
17 }, []);
18
19 async function fetchStocks() {
20 const response = await fetch('/stocks');
21 const data = await response.json();
22 setStocks(data);
33 async function addStock(e) {
34 e.preventDefault();
35 const response = await fetch('/stocks', {
36 method: 'POST',
37 headers: {
42
43 if (response.ok) {
44 fetchStocks();
45 setNewStock({
46 symbol: '',

blobReadPictureExamplemain.tsx1 match

@adnanwahab•Updated 4 months ago
5 try {
6 // Use a public screenshot service that doesn't require authentication
7 const screenshotResponse = await fetch(`https://api.urlbox.io/v1/render/screenshot?url=${encodeURIComponent(url)}&width=1280&height=720`);
8
9 if (!screenshotResponse.ok) {

cerebras_codermain.tsx4 matches

@mimoinverse•Updated 4 months ago
36
37 useEffect(() => {
38 async function fetchStats() {
39 const response = await fetch("/dashboard-stats");
40 const data = await response.json();
41 setStats(data);
42 }
43 fetchStats();
44 }, []);
45
146
147 try {
148 const response = await fetch("/", {
149 method: "POST",
150 body: JSON.stringify({

currencymain.tsx5 matches

@luizhrios•Updated 4 months ago
1import { fetch } from "https://esm.town/v/std/fetch";
2
3function fetchJSON(url) {
4 return fetch(url).then(res => res.json());
5}
6
7export let currency = async (desired, base = "usd", amount = 1) => {
8 let { rates } = await fetchJSON(`https://open.er-api.com/v6/latest/${base}`);
9 if (false && rates && rates[desired.toUpperCase()]) return amount * (rates[desired.toUpperCase()]);
10 else {
11 let { rates } = await fetchJSON("https://api.coingecko.com/api/v3/exchange_rates");
12 return amount * rates[desired.toLowerCase()]?.value / rates[base.toLowerCase()]?.value;
13 }

productiveRosePeacockmain.tsx4 matches

@stevekrouse•Updated 4 months ago
36
37 useEffect(() => {
38 async function fetchStats() {
39 const response = await fetch("/dashboard-stats");
40 const data = await response.json();
41 setStats(data);
42 }
43 fetchStats();
44 }, []);
45
146
147 try {
148 const response = await fetch("/", {
149 method: "POST",
150 body: JSON.stringify({

fetchPaginatedData2 file matches

@nbbaier•Updated 2 weeks ago

FetchBasic1 file match

@fredmoon•Updated 2 weeks ago