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/image-url.jpg%20%22Image%20title%22?q=api&page=82&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 20509 results for "api"(2039ms)

shitty-leaderboardindex.ts8 matches

@jonbo•Updated 1 week ago
51 const timestamp = Date.now();
52 const [choresResponse, historyResponse] = await Promise.all([
53 fetch(`/api/${instanceId}/chores?_t=${timestamp}`),
54 fetch(`/api/${instanceId}/history?_t=${timestamp}`),
55 ]);
56
307 const pathParts = url.pathname.split("/").filter(p => p.trim() !== "");
308
309 // API endpoints - proxy to the main Shitty database
310 if (pathParts[0] === "api" && pathParts.length >= 2) {
311 const syncId = pathParts[1];
312 const apiResource = pathParts.length > 2 ? pathParts[2] : null;
313
314 // Helper to create demo data
403
404 // Chores endpoint
405 if (apiResource === "chores") {
406 return new Response(JSON.stringify(instanceData.chores), {
407 headers: { "Content-Type": "application/json" },
409 }
410 // History endpoint
411 else if (apiResource === "history") {
412 const sortedHistory = [...instanceData.tending_log].sort((a, b) => b.timestamp - a.timestamp);
413 return new Response(JSON.stringify(sortedHistory), {
416 }
417
418 return new Response(JSON.stringify({ error: "API endpoint not found" }), {
419 status: 404,
420 headers: { "Content-Type": "application/json" },

shitty-leaderboardREADME.md1 match

@jonbo•Updated 1 week ago
54Like a good guitar pedal:
55- **Single responsibility**: Each module does one thing well
56- **Standard interface**: Consistent data format and API
57- **Hot-swappable**: Can be added/removed without breaking the chain
58- **Composable**: Multiple modules work together seamlessly
Plantfo

Plantfocache.ts1 match

@Llad•Updated 1 week ago
114 } catch (error) {
115 console.error("Error caching plant:", error);
116 // Don't throw error - caching failure shouldn't break the API
117 }
118}
Plantfo

Plantfoindex.ts4 matches

@Llad•Updated 1 week ago
48}
49
50// Check if user is authenticated (for API endpoints)
51function isAuthenticated(c: any): boolean {
52 const sessionToken = getSignedCookie(c, SESSION_SECRET, "admin_session");
114});
115
116// API info endpoint moved to /api
117app.get("/api", async (c) => {
118 // Only show cache stats if authenticated
119 let cacheInfo = {};
132
133 return c.json({
134 message: "Plant Information API",
135 usage: "GET /plant/:name - Get information about a specific plant",
136 example: "/plant/rose",

fiberplaneHonoTracingStarterREADME.md1 match

@hrev•Updated 1 week ago
1Example Hono app with the Fiberplane API Playground and Tracing enabled.
2
3Note, for this we need to configure some environment variables:

fiberplaneHonoTracingStartermain.tsx12 matches

@hrev•Updated 1 week ago
1import { instrument } from "https://esm.sh/@fiberplane/hono-otel@0.8.0";
2import { createFiberplane, createOpenAPISpec } from "https://esm.sh/@fiberplane/hono@0.4.4";
3import { Hono } from "npm:hono@4.7.0"; // Hono's type inference works better as an npm import for some reason
4import { HTTPException } from "npm:hono@4.7.0/http-exception";
7
8/**
9 * `GET /api/users`
10 *
11 * A mock api route that returns a list of users
12 */
13app.get("/api/users", async (c) => {
14 return c.json({
15 data: [
27
28/**
29 * `GET /openapi.json`
30 *
31 * Returns a simplified OpenAPI spec to power the Fiberplane UI.
32 */
33app.get("/openapi.json", async (c) => {
34 const spec = createOpenAPISpec(app, {
35 info: { title: "My Hono API", version: "1.0.0" },
36 });
37 return c.json(spec);
39
40/**
41 * Mount the Fiberplane API explorer at the root.
42 * This exposes a UI to test the API.
43 */
44app.use(
45 "/*",
46 createFiberplane({
47 openapi: { url: "/openapi.json" },
48 }),
49);

sapo-mag-filmes-em-cartazmain.tsx1 match

@gmcabrita•Updated 1 week ago
65
66/* ------------------------------------------------------------------ */
67/* Utility: minimal XML escaping (only for text nodes) */
68function escapeXml(str: string = ""): string {
69 return str

docjocmain.tsx3 matches

@legal•Updated 1 week ago
387 <div class="card">
388 <h3>Error Loading Suggestions</h3>
389 <p>We couldn't get AI-powered task suggestions. This can happen due to network issues or API errors.</p>
390 <div class="status-entry error">\${esc(suggestionsError)}</div>
391 <button id="retry-suggestions-btn" class="button button-primary" style="margin-top:10px;">Retry Suggestions</button>
938 }
939 } catch (error) {
940 const errMsg = `AI API Error: ${error.message}`;
941 log.push({ agent: agentName, type: "error", message: errMsg });
942 console.error(`${agentName} Error:`, error);
943 return { error: "AI_API_ERROR", message: errMsg, details: error.toString() };
944 }
945 }

Synthesizemain.tsx3 matches

@talkbot•Updated 1 week ago
17 if (path === "/" || path === "") {
18 return c.html(`
19 <h1>Arbitrary JSON API powered by GPT-4o</h1>
20 <p>This endpoint generates JSON data based on the URL path and query parameters.</p>
21 <p>Try some examples:</p>
30 // System prompt to set the context and rules for the AI
31 const systemPrompt =
32 `You are a powerful API that generates structured JSON data based on a user's request. The request is described by an HTTP path and query parameters. Your only output must be a valid JSON object. Do not include any explanatory text, markdown, or code fences (like \`\`\`json). Just the raw JSON.`;
33
34 // User prompt that includes the specific request details
44
45 try {
46 // Call the OpenAI Chat Completions API
47 const completion = await openai.chat.completions.create({
48 model: "gpt-4o",

kebede-and-ben-testApp.tsx2 matches

@bmitchinson•Updated 1 week ago
16
17 try {
18 const response = await fetch('/api/game', {
19 method: 'POST',
20 headers: {
47 const moveData: MoveRequest = { position };
48
49 const response = await fetch(`/api/game/${game.id}/move`, {
50 method: 'PUT',
51 headers: {

claude-api1 file match

@ziyanwould•Updated 12 hours ago

api-workshop

@danarddanielsjr•Updated 1 day ago
replicate
Run AI with an API
fiberplane
Purveyors of Hono tooling, API Playground enthusiasts, and creators of 🪿 HONC 🪿 (https://honc.dev)