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/$1?q=api&page=24&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 18008 results for "api"(3467ms)

thirdTimerval-town.mdc9 matches

@nbbaier•Updated 1 day ago
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
29
30- 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
206
207- 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
268
2695. **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`

ReactHonoStarterTestsindex.ts2 matches

@wolf•Updated 1 day 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

uppsalatech25data.ts4 matches

@ljus•Updated 1 day ago
7});
8type Message = z.infer<typeof messageSchema>;
9type MessageWithSource = Message & { source: "email" | "sms" | "api" };
10export async function getMessages(): Promise<MessageWithSource[]> {
11 let messages = await blob.getJSON(key);
19 return addMessage({ message: email.text, subject: email.subject }, "email");
20}
21export async function addApiMessage(apiMessage: unknown) {
22 return addMessage(apiMessage, "api");
23}
24export async function addSms(sms: unknown) {
27async function addMessage(
28 message: unknown,
29 source: "sms" | "email" | "api",
30): Promise<Message | null> {
31 const allMessages = await getMessages();

uppsalatech25api.tsx2 matches

@ljus•Updated 1 day ago
1import { Hono } from "npm:hono@4";
2import { getConnInfo } from "npm:hono@4/cloudflare-workers";
3import { addApiMessage, addSms, getMessages } from "./data.ts";
4import { verifyElks } from "./verify.tsx";
5
14app.post("/message", async (c) => {
15 const body = await c.req.json();
16 const message = await addApiMessage(body);
17 if (!message) {
18 c.status(400);

templateTwitterAlertREADME.md4 matches

@Nelsonmwaura•Updated 1 day ago
31Refer to [Twitter's search operators](https://socialdata.gitbook.io/docs/twitter-tweets/retrieve-search-results-by-keyword#endpoint-parameters) to fine-tune your query.
32
33### 4. Test API call
34Set `isProd = false` in the code if you are testing, to ensure there are enough tweets to display. <br>
35Toggle it back to `true` when you're ready to run this cron job in production and actuall send notifications.
60
61### NOTE: Usage Limits
62This val uses the SocialData API for Twitter data:
63
64- **Proxies via Val Town's [SocialDataProxy](https://www.val.town/v/stevekrouse/socialDataProxy)**: Limited to 10 cents per day for [**Val Town Pro users**](https://www.val.town/pricing). This API is *only* for Pro users.
65- **Need more calls?** Sign up for your own [SocialData API token](https://socialdata.tools) and configure the [`socialDataSearch`](https://www.val.town/v/stevekrouse/socialDataSearch) function.

uppsalatech25README.md1 match

@ljus•Updated 1 day ago
3
4## HTTP
5Hono API with
6- `GET` route for all message
7. `POST` route for sending a message

simulationcontacts.http.ts2 matches

@lukatmyshu•Updated 1 day ago
202});
203
204// Root endpoint with API documentation
205app.get('/', (c) => {
206 return c.json({
207 message: 'Contacts API',
208 endpoints: {
209 'POST /contacts': 'Create or update a contact (name, address, zipcode, phone_number)',

Glancerindex.ts2 matches

@lightweight•Updated 1 day ago
7
8// Import route modules
9import api from "./routes/api/api.ts";
10import auth from "./routes/auth.ts";
11import root from "./routes/root.ts";
34
35// Mount route modules
36app.route("/api", api);
37app.route("/tasks", tasks);
38app.route("/demo", demo);

Glancerapi.ts0 matches

@lightweight•Updated 1 day ago
1import { Hono } from "npm:hono";
2
3// Import route modules
4import cobrowse from "./cobrowse.ts";
5import database from "./database.ts";

GlancergettingStarted.tsx1 match

@lightweight•Updated 1 day ago
27 }}
28 >
29 <h3 className="font-bold capitalize">
30 {item?.properties?.Name?.title?.[0]?.plain_text}
31 </h3>

Apiify7 file matches

@wolf•Updated 45 mins ago

dailyQuoteAPI

@Souky•Updated 2 days ago
Kapil01
apiv1