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/$%7Bsuccess?q=api&page=124&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 18954 results for "api"(7582ms)

stevensDemoApp.tsx8 matches

@sysbot•Updated 1 week ago
10import { NotebookView } from "./NotebookView.tsx";
11
12const API_BASE = "/api/memories";
13const MEMORIES_PER_PAGE = 20; // Increased from 7 to 20 memories per page
14
90
91 // Fetch avatar image
92 fetch("/api/images/stevens.jpg")
93 .then((response) => {
94 if (response.ok) return response.blob();
104
105 // Fetch wood background
106 fetch("/api/images/wood.jpg")
107 .then((response) => {
108 if (response.ok) return response.blob();
133 setError(null);
134 try {
135 const response = await fetch(API_BASE);
136 if (!response.ok) {
137 throw new Error(`HTTP error! status: ${response.status}`);
176
177 try {
178 const response = await fetch(API_BASE, {
179 method: "POST",
180 headers: { "Content-Type": "application/json" },
199
200 try {
201 const response = await fetch(`${API_BASE}/${id}`, {
202 method: "DELETE",
203 });
231
232 try {
233 const response = await fetch(`${API_BASE}/${editingMemory.id}`, {
234 method: "PUT",
235 headers: { "Content-Type": "application/json" },
606 <div className="font-pixel text-[#f8f1e0]">
607 <style jsx>{`
608 @import url("https://fonts.googleapis.com/css2?family=Pixelify+Sans&display=swap");
609
610 @tailwind base;

sqliteExplorerAppREADME.md1 match

@cricks_unmixed4u•Updated 1 week ago
13## Authentication
14
15Login to your SQLite Explorer with [password authentication](https://www.val.town/v/pomdtr/password_auth) with your [Val Town API Token](https://www.val.town/settings/api) as the password.
16
17## Todos / Plans

sqliteExplorerAppmain.tsx2 matches

@cricks_unmixed4u•Updated 1 week ago
27 <head>
28 <title>SQLite Explorer</title>
29 <link rel="preconnect" href="https://fonts.googleapis.com" />
30
31 <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
32 <link
33 href="https://fonts.googleapis.com/css2?family=Fira+Code:wght@300..700&family=Source+Sans+3:ital,wght@0,200..900;1,200..900&display=swap"
34 rel="stylesheet"
35 />

thirdTimerval-town.mdc9 matches

@nbbaier•Updated 1 week 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 week 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 week 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 week 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 week 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 week 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 week 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)',

beeminder-api4 file matches

@cricks_unmixed4u•Updated 7 hours ago

shippingAPI1 file match

@dynamic_silver•Updated 23 hours ago
apiry
snartapi