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=api&page=221&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 12884 results for "api"(1251ms)

OpenTownieApp.tsx3 matches

@charmaineUpdated 2 weeks ago
17export function App() {
18 const [bearerToken, setBearerToken] = useLocalStorage("bearer", "");
19 const [anthropicApiKey, setAnthropicApiKey] = useLocalStorage("anthropic_api_key", "");
20 const [projectJSON, setProjectJSON] = useLocalStorage("project", "");
21 const [project, setProject_] = useState(safeParse(projectJSON));
30 setBearerToken("");
31 setShowLogin(false);
32 // Keep the anthropic API key in case the user wants to reuse it
33 }
34
41 <Chat
42 bearerToken={bearerToken}
43 anthropicApiKey={anthropicApiKey}
44 project={project}
45 setProject={setProject}

OpenTownieapi.ts1 match

@charmaineUpdated 2 weeks ago
3 { bearerToken, projectId, branchId }: { bearerToken: string; projectId: string; branchId?: string },
4) {
5 const url = new URL("/api/project-files", window.location.origin);
6 url.searchParams.append("projectId", projectId);
7 if (branchId) {

OpenTownieApiKeyWarning.tsx4 matches

@charmaineUpdated 2 weeks ago
2import React from "https://esm.sh/react@18.2.0?dev";
3
4interface ApiKeyWarningProps {
5 show: boolean;
6}
7
8export function ApiKeyWarning({ show }: ApiKeyWarningProps) {
9 if (!show) return null;
10
11 return (
12 <div className="bg-yellow-100 border-l-4 border-yellow-500 text-yellow-700 p-4 mb-4 rounded">
13 <p className="font-bold">Anthropic API Key Missing</p>
14 <p>Please log out and add your Anthropic API key to use this app.</p>
15 </div>
16 );

AHC_Employees_Forummain.tsx2 matches

@editrust123Updated 2 weeks ago
109</head>
110<body>
111 <h1>User Management API</h1>
112 <p>Use browser console or tools like Postman to interact with this API</p>
113 <pre>
114 GET /username - Retrieve a user

ProtoRunsRunForm.tsx1 match

@wilhelmUpdated 2 weeks ago
3import { Run, runSchemaMap } from "../../shared/run_lexicon.ts";
4import { ATProtoContext } from "../context.ts";
5import { type BlobRef } from "https://esm.sh/@atproto/api@0.15.5";
6
7export function RunForm() {

ProtoRunsrun_lexicon.ts1 match

@wilhelmUpdated 2 weeks ago
1import { lexiconToZod } from "https://esm.sh/lexicon-to-zod@1.0.2";
2import { type BlobRef } from "https://esm.sh/@atproto/api@0.15.5";
3
4const lexicon = {

vtEditorFiles.cursorrules10 matches

@stdUpdated 2 weeks ago
13- Generate code in TypeScript or TSX
14- Add appropriate TypeScript types and interfaces for all data structures
15- Prefer official SDKs or libraries than writing API calls directly
16- Ask the user to supply API or library documentation if you are at all unsure about it
17- **Never bake in secrets into the code** - always use environment variables
18- Include comments explaining complex logic (avoid commenting obvious operations)
23### 1. HTTP Trigger
24
25- Create web APIs and endpoints
26- Handle HTTP requests and responses
27- Example structure:
173However, it's *extremely importing* to note that `parseProject` and other Standard Library utilities ONLY RUN ON THE SERVER.
174If you need access to this data on the client, run it in the server and pass it to the client by splicing it into the HTML page
175or by making an API request for it.
176
177## Val Town Platform Specifics
181- **AI Image:** To inline generate an AI image use: `<img src="https://maxm-imggenurl.web.val.run/the-description-of-your-image" />`
182- **Storage:** DO NOT use the Deno KV module for storage
183- **Browser APIs:** DO NOT use the `alert()`, `prompt()`, or `confirm()` methods
184- **Weather Data:** Use open-meteo for weather data (doesn't require API keys) unless otherwise specified
185- **View Source:** Add a view source link by importing & using `import.meta.url.replace("ems.sh", "val.town)"` (or passing this data to the client) and include `target="_top"` attribute
186- **Error Debugging:** Add `<script src="https://esm.town/v/std/catch"></script>` to HTML to capture client-side errors
187- **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
188- **Environment Variables:** Use `Deno.env.get('keyname')` when you need to, but generally prefer APIs that don't require keys
189- **Imports:** Use `https://esm.sh` for npm and Deno dependencies to ensure compatibility on server and browser
190- **Storage Strategy:** Only use backend storage if explicitly required; prefer simple static client-side sites
224### Backend (Hono) Best Practices
225
226- Hono is the recommended API framework
227- Main entry point should be `backend/index.ts`
228- **Static asset serving:** Use the utility functions to read and serve project files:
248 });
249 ```
250- Create RESTful API routes for CRUD operations
251- Always include this snippet at the top-level Hono app to re-throwing errors to see full stack traces:
252 ```ts
285 - For files in the project, use `readFile` helpers
286
2875. **API Design:**
288 - `fetch` handler is the entry point for HTTP vals
289 - Run the Hono app with `export default app.fetch // This is the entry point for HTTP vals`

Emotional_Companionmain.tsx1 match

@ScollyUpdated 2 weeks ago
310// CSS definition
311const css = `
312@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;600&display=swap');
313
314:root {

cerebras_coderstarter-prompts.js1 match

@Parvezalm6Updated 2 weeks ago
12 },
13 {
14 "prompt": "weather dashboard for nyc using open-meteo API for NYC with icons",
15 "title": "Weather App",
16 "code":

cerebras_coderREADME.md2 matches

@Parvezalm6Updated 2 weeks ago
8
91. Sign up for [Cerebras](https://cloud.cerebras.ai/)
102. Get a Cerebras API Key
113. Save it in your project env variable called `CEREBRAS_API_KEY`

vapi-minutes-db1 file match

@henrywilliamsUpdated 1 day ago

vapi-minutes-db2 file matches

@henrywilliamsUpdated 1 day ago
papimark21
socialdata
Affordable & reliable alternative to Twitter API: ➡️ Access user profiles, tweets, followers & timeline data in real-time ➡️ Monitor profiles with nearly instant alerts for new tweets, follows & profile updates ➡️ Simple integration