You can access search results via JSON API by adding format=json
to your query:
https://codesearch.val.run/$%7Burl%7D?q=api&page=54&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 19733 results for "api"(1508ms)
78<!-- Google Fonts: Poppins -->
9<link rel="preconnect" href="https://fonts.googleapis.com">
10<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
11<link
12href="https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;600;700&display=swap"
13rel="stylesheet"
14>
51const timestamp = Date.now();
52const [choresResponse, historyResponse] = await Promise.all([
53fetch(`/api/${instanceId}/chores?_t=${timestamp}`),
54fetch(`/api/${instanceId}/history?_t=${timestamp}`),
55]);
56316const pathParts = url.pathname.split("/").filter(p => p.trim() !== "");
317318// API endpoints - proxy to the main Shitty database
319if (pathParts[0] === "api" && pathParts.length >= 2) {
320const syncId = pathParts[1];
321const apiResource = pathParts.length > 2 ? pathParts[2] : null;
322323// Helper to create demo data
412413// Chores endpoint
414if (apiResource === "chores") {
415return new Response(JSON.stringify(instanceData.chores), {
416headers: { "Content-Type": "application/json" },
418}
419// History endpoint
420else if (apiResource === "history") {
421const sortedHistory = [...instanceData.tending_log].sort((a, b) => b.timestamp - a.timestamp);
422return new Response(JSON.stringify(sortedHistory), {
425}
426427return new Response(JSON.stringify({ error: "API endpoint not found" }), {
428status: 404,
429headers: { "Content-Type": "application/json" },