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=4&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 4127 results for "api"(245ms)

valProfilePageindex.ts3 matches

@dcm31•Updated 1 day ago
4const app = new Hono();
5
6// API endpoint to fetch user profile data
7app.get("/api/profile/:username", async (c) => {
8 const username = c.req.param("username");
9
10 try {
11 // Call the user search API
12 const response = await fetch(
13 `https://charliesusersearch.val.run/?user=${username}`

valProfilePageValGridItem.tsx1 match

@dcm31•Updated 1 day ago
84 const getImageUrl = () => {
85 // Priority order:
86 // 1. Val's image_url from API if available
87 // 2. moi.md imageUrl if available
88 // 3. Return null to use color placeholder

valProfilePageUserProfile.tsx1 match

@dcm31•Updated 1 day ago
64 // Fetch both user profile data and moi config in parallel
65 const [profileResponse, config] = await Promise.all([
66 fetch(`/api/profile/${username}?page=${currentPage}`),
67 fetchMoiConfig(`https://www.val.town/x/${username}/`)
68 ]);

valProfilePagemoiConfig.tsx1 match

@dcm31•Updated 1 day ago
117 }
118
119 // Fallback: Use Val Town profile pic API
120 return `https://pic.val.run/${username}`;
121}
vtProjectSearch

vtProjectSearchapi.tsx3 matches

@dcm31•Updated 1 day ago
13import { SearchResponse as _SearchResponse } from "./types.tsx";
14
15// Handle typeahead API requests
16export function handleTypeahead(req: Request): Response {
17 const url = new URL(req.url);
45}
46
47// Handle user vals API requests
48export async function handleUserVals(req: Request): Response {
49 const url = new URL(req.url);
201 searchTerm
202 ? (needFullDocsData
203 ? searchDocs(searchTerm, page, pageSize, true) // Get full data for docs tab or JSON API
204 : searchDocsCount(searchTerm).then(count => ({ results: [], totalResults: count }))) // Just get count for other tabs in HTML view
205 : { results: [], totalResults: 0 },
vtProjectSearch

vtProjectSearchstyles.tsx4 matches

@dcm31•Updated 1 day ago
782}
783
784.api-info {
785 margin-top: 10px;
786}
787
788.api-info summary {
789 cursor: pointer;
790 color: var(--primary-color);
792}
793
794.api-docs {
795 background-color: var(--code-bg);
796 padding: 10px 15px;
801}
802
803.api-docs code {
804 display: inline-block;
805 background-color: white;
vtProjectSearch

vtProjectSearchimport.ts1 match

@dcm31•Updated 1 day ago
37 profile_image_url: user.profileImageUrl,
38 url: user.url,
39 updated_at: new Date().toISOString(), // Using current time as the API doesn't provide updated_at
40 });
41
vtProjectSearch

vtProjectSearchcomponents.tsx8 matches

@dcm31•Updated 1 day ago
1063 <link rel="icon" href="https://fav.farm/👀" />
1064 <meta name="viewport" content="width=device-width, initial-scale=1" />
1065 <link rel="preconnect" href="https://fonts.googleapis.com" />
1066 <link rel="preconnect" href="https://fonts.gstatic.com" crossOrigin="anonymous" />
1067 <link
1068 href="https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:ital,wght@0,100..700;1,100..700&display=swap"
1069 rel="stylesheet"
1070 />
1080 <a href="https://val.town" className="valtown-link" style={{ marginLeft: "auto" }}>Return to Val Town</a>
1081 </h1>
1082 <div className="api-info">
1083 <details>
1084 <summary>API Access</summary>
1085 <div className="api-docs">
1086 <p>
1087 You can access search results via JSON API by adding <code>format=json</code> to your query:
1088 </p>
1089 {searchTerm
1241 <div className="search-examples">
1242 <a href="?q=fetch" className="example-link">fetch</a>
1243 <a href="?q=api" className="example-link">api</a>
1244 <a href="?q=database" className="example-link">database</a>
1245 <a href="?q=image" className="example-link">image</a>
1396 <div className="search-examples">
1397 <a href="?q=fetch" className="example-link">fetch</a>
1398 <a href="?q=api" className="example-link">api</a>
1399 <a href="?q=database" className="example-link">database</a>
1400 <a href="?q=image" className="example-link">image</a>
vtProjectSearch

vtProjectSearchweb.http.tsx1 match

@dcm31•Updated 1 day ago
1import { handler } from "./api.tsx";
2import { loadTypeaheadDataIntoMemory } from "./db.ts";
3
vtProjectSearch

vtProjectSearchdeno.lock2 matches

@dcm31•Updated 1 day ago
363 },
364 "redirects": {
365 "https://esm.town/v/std/API_URL": "https://esm.town/v/std/API_URL?v=5",
366 "https://esm.town/v/stevekrouse/sqlite": "https://esm.town/v/stevekrouse/sqlite?v=13"
367 },
368 "remote": {
369 "https://docs.val.town/pagefind/pagefind.js": "43ee232b23e27fa6b00d4f71f08a165d35a824947525989c7a051843e408e0c0",
370 "https://esm.town/v/std/API_URL?v=5": "46109f905a50e32281d3ffbe7b9c8209a778290c5274d83d131fba2d26c4974d",
371 "https://esm.town/v/stevekrouse/sqlite?v=13": "3b613197e9da35db335dc2726c062c61f9247439c10a0c64c118994e200ffa46"
372 }

openapi2 file matches

@stevekrouse•Updated 1 day ago

dbToAPI_backup4 file matches

@nbbaier•Updated 3 days ago
artivilla
founder @outapint.io vibe coding on val.town. dm me to build custom vals: https://artivilla.com
fiberplane
Purveyors of Hono tooling, API Playground enthusiasts, and creators of 🪿 HONC 🪿 (https://honc.dev)