You can access search results via JSON API by adding format=json
to your query:
https://codesearch.val.run/$1?q=api&page=34&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 19777 results for "api"(1598ms)
18- Generate code in TypeScript or TSX
19- Add appropriate TypeScript types and interfaces for all data structures
20- Prefer official SDKs or libraries than writing API calls directly
21- Ask the user to supply API or library documentation if you are at all unsure about it
22- **Never bake in secrets into the code** - always use environment variables
23- Include comments explaining complex logic (avoid commenting obvious operations)
28### 1. HTTP Trigger
2930- Create web APIs and endpoints
31- Handle HTTP requests and responses
32- Example structure:
163- **AI Image:** To inline generate an AI image use: `<img src="https://maxm-imggenurl.web.val.run/the-description-of-your-image" />`
164- **Storage:** DO NOT use the Deno KV module for storage
165- **Browser APIs:** DO NOT use the `alert()`, `prompt()`, or `confirm()` methods
166- **Weather Data:** Use open-meteo for weather data (doesn't require API keys) unless otherwise specified
167- **Error Debugging:** Add `<script src="https://esm.town/v/std/catch"></script>` to HTML to capture client-side errors
168- **Error Handling:** Only use try...catch when there's a clear local resolution; Avoid catches that merely log or return 500s. Let errors bubble up with full context
169- **Environment Variables:** Use `Deno.env.get('keyname')` when you need to, but generally prefer APIs that don't require keys
170- **Imports:** Use `https://esm.sh` for npm and Deno dependencies to ensure compatibility on server and browser
171- **Storage Strategy:** Only use backend storage if explicitly required; prefer simple static client-side sites
205### Backend (Hono) Best Practices
206207- Hono is the recommended API framework
208- Main entry point should be `backend/index.ts`
209- Do NOT use Hono serveStatic middleware
230});
231```
232- Create RESTful API routes for CRUD operations
233- Always include this snippet at the top-level Hono app to re-throwing errors to see full stack traces:
234```ts
267- For files in the project, use `readFile` helpers
2682695. **API Design:**
270- `fetch` handler is the entry point for HTTP vals
271- Run the Hono app with `export default app.fetch // This is the entry point for HTTP vals`
257<div>
258<a href="/std/openai" class="example-link">🤖 OpenAI Integration</a>
259<span class="text-sm text-gray-500">- AI API wrapper</span>
260</div>
261</div>
305<div>
306<a href="https://github.com/val-town/val-town/blob/main/README.md" class="text-blue-600 hover:text-blue-800 font-medium">📖 Full Documentation</a>
307<p class="text-sm text-gray-600">Complete usage guide, API reference, and customization options</p>
308</div>
309<div>