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/$%7Burl%7D?q=api&page=44&format=json

For typeahead suggestions, use the /typeahead endpoint:

https://codesearch.val.run/typeahead?q=api

Returns an array of strings in format "username" or "username/projectName"

Found 14450 results for "api"(917ms)

untitled-3195index.ts4 matches

@jeffreyyoungUpdated 2 days ago
104});
105
106// API endpoint to process zip URLs
107app.post("/api/process-zip", async (c) => {
108 const { zipUrl } = await c.req.json();
109
121
122// Debug endpoint to see what files are in a hosted site
123app.get("/api/debug/:siteId", async (c) => {
124 const siteId = c.req.param("siteId");
125
142
143// List all cached sites
144app.get("/api/sites", async (c) => {
145 try {
146 const keys = await blob.list("site_");

untitled-3195README.md4 matches

@jeffreyyoungUpdated 2 days ago
27- Cached sites persist until manually cleared
28
29## API
30
31- `GET /` - Main interface
32- `GET /?zip_url={url}` - Download and host zip from URL (or reuse cached)
33- `GET /hosted/{id}/*` - Access hosted websites
34- `GET /api/sites` - List all cached sites
35- `GET /api/debug/{id}` - Debug info for a specific site
36
37## Project Structure
38
39- `backend/` - Hono API server with caching logic
40- `frontend/` - Simple web interface with cached sites viewer
41- `shared/` - Shared utilities and types

untitled-3195index.html1 match

@jeffreyyoungUpdated 2 days ago
128 // Load and show cached sites
129 try {
130 const response = await fetch('/api/sites');
131 const sites = await response.json();
132

gfindex.ts12 matches

@jiushangxUpdated 3 days ago
18});
19
20// Chat API endpoint
21app.post("/api/chat", async c => {
22 try {
23 const { messages } = await c.req.json();
27 }
28
29 const apiKey = Deno.env.get("XAI_API_KEY");
30 if (!apiKey) {
31 return c.json({ error: "XAI_API_KEY environment variable not set" }, 500);
32 }
33
34 // Call xAI Grok API
35 const response = await fetch("https://api.x.ai/v1/chat/completions", {
36 method: "POST",
37 headers: {
38 "Content-Type": "application/json",
39 "Authorization": `Bearer ${apiKey}`,
40 },
41 body: JSON.stringify({
49 if (!response.ok) {
50 const errorText = await response.text();
51 console.error("xAI API error:", errorText);
52 return c.json({ error: "Failed to get response from Grok" }, 500);
53 }
56
57 if (!data.choices || !data.choices[0] || !data.choices[0].message) {
58 return c.json({ error: "Invalid response from Grok API" }, 500);
59 }
60
65
66 } catch (error) {
67 console.error("Chat API error:", error);
68 return c.json({ error: "Internal server error" }, 500);
69 }
71
72// Health check endpoint
73app.get("/api/health", c => {
74 return c.json({ status: "ok", timestamp: new Date().toISOString() });
75});

gfREADME.md5 matches

@jiushangxUpdated 3 days ago
1# Grok Chat Application
2
3A ChatGPT-like interface using xAI's Grok API.
4
5## Features
13## Setup
14
151. Set the environment variable `XAI_API_KEY` with your xAI API key
162. Deploy the backend as an HTTP val
173. Access the chat interface at the root URL
19## Project Structure
20
21- `backend/index.ts` - Main Hono server with API routes
22- `frontend/index.html` - Chat interface
23- `frontend/app.js` - Frontend JavaScript logic
24- `frontend/style.css` - Custom styles
25
26## API Endpoints
27
28- `GET /` - Serves the chat interface
29- `POST /api/chat` - Handles chat messages and returns Grok responses
amzn-top-100-trckr

amzn-top-100-trckrscheduler.ts2 matches

@nuckyUpdated 3 days ago
20 // Save the books to the database
21 await saveBooks(result.books);
22 console.log(`✅ Scraping completed successfully: ${result.booksFound} books found and saved`);
23 } else {
24 console.error("❌ Scraping failed:", result.errors);
25
26 // If rate limited, this is expected and not a critical error
amzn-top-100-trckr

amzn-top-100-trckrindex.tsx11 matches

@nuckyUpdated 3 days ago
11 const [books, setBooks] = useState<BookHistory[]>([]);
12 const [loading, setLoading] = useState(false);
13 const [scraping, setScraping] = useState(false);
14 const [lastUpdate, setLastUpdate] = useState<string>("");
15
30 setLoading(true);
31 try {
32 const response = await fetch("/api/books");
33 const data = await response.json();
34 setBooks(data.books || []);
44
45 const triggerScrape = async () => {
46 setScraping(true);
47 try {
48 const response = await fetch("/api/scrape", { method: "POST" });
49 const result = await response.json();
50
51 if (result.success) {
52 alert(`Scraping completed! Found ${result.booksFound} books.`);
53 await loadBooks(); // Reload data
54 } else {
55 alert(`Scraping failed: ${result.errors?.join(", ") || result.error}`);
56 }
57 } catch (error) {
58 alert(`Scraping error: ${error.message}`);
59 } finally {
60 setScraping(false);
61 }
62 };
63
64 const downloadCSV = () => {
65 window.open("/api/books/csv", "_blank");
66 };
67
87 <button
88 onClick={triggerScrape}
89 disabled={scraping}
90 className="bg-blue-600 hover:bg-blue-700 disabled:bg-blue-400 text-white px-4 py-2 rounded-lg font-medium transition-colors"
91 >
92 {scraping ? "🔄 Scraping..." : "🔄 Scrape Now"}
93 </button>
94
amzn-top-100-trckr

amzn-top-100-trckrqueries.ts1 match

@nuckyUpdated 3 days ago
67}
68
69export async function getScrapingDates(): Promise<string[]> {
70 const result = await sqlite.execute(
71 `SELECT DISTINCT scraped_at FROM ${TABLE_NAME} ORDER BY scraped_at DESC LIMIT 30`
amzn-top-100-trckr

amzn-top-100-trckrtypes.ts1 match

@nuckyUpdated 3 days ago
26}
27
28export interface ScrapingResult {
29 success: boolean;
30 booksFound: number;

reactHonoStarterindex.ts2 matches

@jessicagarsonUpdated 3 days ago
12app.get("/frontend/**/*", c => serveFile(c.req.path, import.meta.url));
13
14// Add your API routes here
15// app.get("/api/data", c => c.json({ hello: "world" }));
16
17// Unwrap and rethrow Hono errors as the original error

createemailapiv22 file matches

@souravvmishraUpdated 23 hours ago

waec_api6 file matches

@seyistryUpdated 1 day ago
snartapi
mux
Your friendly, neighborhood video API.