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=558&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 8457 results for "fetch"(1133ms)

stockAPImain.tsx4 matches

@pete•Updated 7 months ago
3const ALPHA_VANTAGE_API_KEY = "your_api_key_here"; // Replace with your actual API key
4
5async function fetchStockData(symbol: string) {
6 const apiUrl =
7 `https://www.alphavantage.co/query?function=GLOBAL_QUOTE&symbol=${symbol}&apikey=${ALPHA_VANTAGE_API_KEY}`;
8 const response = await fetch(apiUrl);
9 const data = await response.json();
10
39
40 try {
41 const stockData = await fetchStockData(symbol);
42 return new Response(JSON.stringify(stockData, null, 2), {
43 headers: { "Content-Type": "application/json" },
61 }
62
63 fetchStockData(symbol).then(stockData => {
64 console.log(`Symbol: ${stockData.symbol}`);
65 console.log(`Price: $${stockData.price.toFixed(2)}`);

uptimemain.tsx2 matches

@cjpais•Updated 7 months ago
11 const start = performance.now();
12 try {
13 const res = await fetch(url);
14 end = performance.now();
15 status = res.status;
22 } catch (e) {
23 end = performance.now();
24 reason = `couldn't fetch: ${e}`;
25 ok = false;
26 console.log(`Website down (${url}): ${reason} (${end - start}ms)`);

csvToSqliteUploadermain.tsx1 match

@vawogbemi•Updated 7 months ago
34 setIsUploading(true);
35 try {
36 const response = await fetch("/upload", {
37 method: "POST",
38 body: formData,

placeholderKittenImagesmain.tsx1 match

@ashryanio•Updated 7 months ago
136 try {
137 console.log(`Generating image with dimensions: ${width}x${height}`);
138 const imageResponse = await fetch(imageGenerationUrl);
139 console.log(`Response status: ${imageResponse.status}`);
140

FanFicScrapermain.tsx2 matches

@willthereader•Updated 7 months ago
13 console.log(`Submitting URL for scraping: ${url}`);
14 try {
15 const response = await fetch("/scrape", {
16 method: "POST",
17 headers: { "Content-Type": "application/json" },
107 const startTime = Date.now();
108 try {
109 const response = await fetch(
110 `https://app.scrapingbee.com/api/v1/?api_key=${apiKey}&url=${
111 encodeURIComponent(url)

getBlobAndRenderAsImageREADME.md3 matches

@ashryanio•Updated 7 months ago
12## How it works
13
141. Fetching the blob:
15
16 - The client-side React component makes a fetch request to "/image".
17 - This request is handled by our server function.
18
405. Client-side handling:
41
42 - The fetch request in the React component receives the Response.
43 - We call `response.blob()` to get a Blob object from the Response.
44

blob_adminmain.tsx2 matches

@ashryanio•Updated 7 months ago
1/** @jsxImportSource https://esm.sh/hono@4.0.8/jsx **/
2
3import { modifyFetchHandler } from "https://esm.town/v/andreterron/codeOnValTown?v=50";
4import view_route from "https://esm.town/v/pomdtr/blob_admin_blob";
5import create_route from "https://esm.town/v/pomdtr/blob_admin_create";
137});
138
139export default modifyFetchHandler(passwordAuth(app.fetch));

MaplJITmain.tsx3 matches

@aquapi•Updated 7 months ago
22 });
23
24const fetch = jitc(app);
25console.log(fetch.toString());
26
27export default fetch;

count_visitsmain.tsx8 matches

@nicosql•Updated 7 months ago
11 if (!websiteUrl) return;
12
13 const response = await fetch("/generate-embed", {
14 method: "POST",
15 headers: { "Content-Type": "application/json" },
25
26 useEffect(() => {
27 const fetchVisitorCount = async () => {
28 if (websiteUrl) {
29 const response = await fetch(`/visitor-count?url=${encodeURIComponent(websiteUrl)}`);
30 if (response.ok) {
31 const { count } = await response.json();
35 };
36
37 fetchVisitorCount();
38 const interval = setInterval(fetchVisitorCount, 5000);
39 return () => clearInterval(interval);
40 }, [websiteUrl]);
96
97 useEffect(() => {
98 const fetchCount = async () => {
99 const response = await fetch('${url.origin}/count-visitor?url=${encodedUrl}');
100 if (response.ok) {
101 const { count } = await response.json();
104 };
105
106 fetchCount();
107 }, []);
108

harshAquamarineRoostermain.tsx2 matches

@nicosql•Updated 7 months ago
35
36async function execute(statement: InStatement, args?: InArgs): Promise<ResultSet> {
37 const res = await fetch(`${API_URL}/v1/sqlite/execute`, {
38 method: "POST",
39 headers: {
50
51async function batch(statements: InStatement[], mode?: TransactionMode): Promise<ResultSet[]> {
52 const res = await fetch(`${API_URL}/v1/sqlite/batch`, {
53 method: "POST",
54 headers: {

fetchPaginatedData2 file matches

@nbbaier•Updated 2 weeks ago

FetchBasic1 file match

@fredmoon•Updated 2 weeks ago