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?q=api&page=41&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 15466 results for "api"(2449ms)

umbrellaReminder2README.md1 match

@stevekrouseUpdated 2 days ago
13
141. Geocodes a free-form description of a location to latitude and longitude using @stevekrouse.nominatimSearch
152. Gets hourly weather forecast from Open-Meteo API (free, no API key required)
163. Filters the forecast for today's remaining hours with ≥30% chance of rain
174. If there are any, it formats them appropriately and sends an email reminder

ProtoShareAuth.tsx2 matches

@c15rUpdated 2 days ago
37
38 // Start WebAuthn flow
39 const startEndpoint = isRegister ? '/api/auth/register-start' : '/api/auth/login-start';
40 const startPayload = isRegister ? { email, name } : { email };
41
115
116 // Finish authentication
117 const finishEndpoint = isRegister ? '/api/auth/register-finish' : '/api/auth/login-finish';
118 const finishResponse = await fetch(finishEndpoint, {
119 method: 'POST',
5// Initialize Notion client
6const notion = new Client({
7 auth: Deno.env.get("NOTION_API_KEY"),
8});
9
11 return {
12 status: "connected",
13 message: "Successfully connected to Notion API",
14 databases: response.results.map((db) => ({
15 title: db.title?.[0]?.plain_text || "Untitled",

Glancer-backup-as-of-5-31root.ts2 matches

@lightweightUpdated 2 days ago
6// Initialize Notion client
7const notion = new Client({
8 auth: Deno.env.get("NOTION_API_KEY"),
9});
10
20 {
21 status: "error",
22 message: "Failed to connect to Notion API",
23 error: error.message,
24 },

Hompageindex.ts2 matches

@dukkyUpdated 2 days ago
7 <title>Your Homepage</title>
8 <script src="https://cdn.twind.style" crossorigin></script>
9 <link rel="preconnect" href="https://fonts.googleapis.com">
10 <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
11 <link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap" rel="stylesheet">
12 <style>
13 :root {

Weather_Cardmain.tsx10 matches

@sky_porie_fire443Updated 2 days ago
5
6 // 处理IP地理位置查询
7 if (url.pathname === "/api/location") {
8 try {
9 // 获取客户端IP地址
11 console.log("Client IP:", clientIP);
12
13 // 使用IP地理定位API
14 const locationResponse = await fetch(
15 `http://ip-api.com/json/${clientIP}?lang=zh-CN&fields=status,message,country,regionName,city,lat,lon,timezone`,
16 );
17 const locationData = await locationResponse.json();
50 }
51 } catch (error) {
52 console.error("Location API error:", error);
53 return new Response(
54 JSON.stringify({
72 }
73
74 // 处理天气API请求
75 if (url.pathname === "/api/weather") {
76 try {
77 const province = url.searchParams.get("province") || "北京";
106 });
107 } catch (error) {
108 console.error("Weather API error:", error);
109 return new Response(
110 JSON.stringify({
516 setLoading(true, '正在获取位置信息...');
517
518 const response = await fetch('/api/location');
519 const data = await response.json();
520
563 refreshBtn.classList.add('loading');
564
565 const apiUrl = \`/api/weather?province=\${encodeURIComponent(location.province)}&city=\${encodeURIComponent(location.city)}&county=\${encodeURIComponent(location.county)}\`;
566
567 const response = await fetch(apiUrl);
568 const data = await response.json();
569

HN-fetch-callmain.tsx1 match

@ImGqbUpdated 2 days ago
1import { fetchItem, fetchMaxItemId } from "./api.tsx";
2import { spider } from "./fetch.tsx";
3

Glancer-backup-as-of-5-31README.md11 matches

@lightweightUpdated 2 days ago
17 let html = await readFile("/frontend/index.html", import.meta.url);
18
19 const response = await fetch(`/api/demo/${id}`);
20 const initialData = await response.json();
21
87// Client-side event recording
88window.recordClick = function (action) {
89 fetch(`/api/setAction`, {
90 method: "POST",
91 headers: { "Content-Type": "application/json" },
103
104```
105├── backend/ # Server-side logic and API routes
106│ ├── controllers/ # Business logic for Notion integration
107│ ├── crons/ # Scheduled tasks for cache management
108│ ├── routes/ # HTTP route handlers
109│ │ ├── api/ # JSON API endpoints
110│ │ ├── tasks/ # Notion webhook handlers
111│ │ └── views/ # HTML page serving
121### Backend (`/backend`)
122
123Handles all server-side operations including API routes, Notion integration, and static file serving. Built with Hono for routing and includes authentication middleware.
124
125### Frontend (`/frontend`)
134
135- **Val Town & Deno**: Serverless runtime environment with TypeScript support
136- **Notion Client**: Official npm library for Notion API integration
137- **Hono**: Lightweight web framework for routing and middleware
138- **Blob Storage**: Val Town's built-in caching solution for performance optimization
170
171// Route modules
172app.route("/api", api); // JSON API endpoints
173app.route("/tasks", tasks); // Notion webhook handlers
174app.route("/demo", demo); // Demo page serving
175```
176
177#### API Routes (`/api`)
178
179Serve JSON data and handle CRUD operations for demo management, cobrowsing status, and user interactions.
241```typescript
242const notion = new Client({
243 auth: Deno.env.get("NOTION_API_KEY"),
244});
245
249Required environment variables:
250
251- `NOTION_API_KEY`: Notion integration token
252- `GLANCE_DEMOS_DB_ID`: Notion database ID for demo pages
253- `GLANCE_INTERACTIONS_DB_ID`: Notion database ID for interaction tracking
289Different route areas serve specific purposes:
290
291- `/api/*`: JSON data endpoints for frontend consumption
292- `/demo/*`: Personalized demo page serving with data injection
293- `/tasks/*`: Notion webhook processing and database updates

Glancer3Remixtasks.ts1 match

@stevekrouseUpdated 2 days ago
11// Initialize Notion client
12export const notion = new Client({
13 auth: Deno.env.get("NOTION_API_KEY"),
14});
15

Glancer3RemixsetPageID.ts1 match

@stevekrouseUpdated 2 days ago
3// Initialize Notion client
4const notion = new Client({
5 auth: Deno.env.get("NOTION_API_KEY"),
6});
7

HN-fetch-call2 file matches

@ImGqbUpdated 2 days ago
fetch HackerNews by API

token-server1 file match

@kwhinnery_openaiUpdated 3 days ago
Mint tokens to use with the OpenAI Realtime API for WebRTC
Kapil01
apiv1