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%20%22Optional%20title%22?q=api&page=964&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 25369 results for "api"(5394ms)

untitled-6580README.md5 matches

@c4nl3zโ€ขUpdated 3 months ago
32```
33
34## API Endpoints
35
36- `GET /api/products` - Get all products
37- `POST /api/products` - Create a new product
38- `GET /api/chat/messages` - Get chat messages
39- `POST /api/chat/messages` - Send a chat message
40
41## Database Schema

untitled-6073index.ts2 matches

@Ayskrmi028โ€ขUpdated 3 months ago
15await createTasksTable();
16
17// API routes
18app.route("/api/tasks", tasks);
19
20// Serve static files

ffffindex.tsx1 match

@hardโ€ขUpdated 3 months ago
167
168 try {
169 const response = await fetch('/api/generate-poem', {
170 method: 'POST',
171 headers: {

untitled-6073App.tsx12 matches

@Ayskrmi028โ€ขUpdated 3 months ago
1/** @jsxImportSource https://esm.sh/react@18.2.0 */
2import React, { useState, useEffect } from "https://esm.sh/react@18.2.0";
3import type { Task, ApiResponse, CreateTaskRequest, UpdateTaskRequest } from "../../shared/types.ts";
4import TaskForm from "./TaskForm.tsx";
5import TaskItem from "./TaskItem.tsx";
17 const [filter, setFilter] = useState<'all' | 'active' | 'completed'>('all');
18
19 // Load initial tasks from server-side injection or fetch from API
20 useEffect(() => {
21 if (window.__INITIAL_TASKS__) {
30 setLoading(true);
31 setError(null);
32 const response = await fetch('/api/tasks');
33 const result: ApiResponse<Task[]> = await response.json();
34
35 if (result.success && result.data) {
48 try {
49 setError(null);
50 const response = await fetch('/api/tasks', {
51 method: 'POST',
52 headers: { 'Content-Type': 'application/json' },
54 });
55
56 const result: ApiResponse<Task> = await response.json();
57
58 if (result.success && result.data) {
69 try {
70 setError(null);
71 const response = await fetch(`/api/tasks/${id}`, {
72 method: 'PUT',
73 headers: { 'Content-Type': 'application/json' },
75 });
76
77 const result: ApiResponse<Task> = await response.json();
78
79 if (result.success && result.data) {
92 try {
93 setError(null);
94 const response = await fetch(`/api/tasks/${id}`, {
95 method: 'PUT',
96 headers: { 'Content-Type': 'application/json' },
98 });
99
100 const result: ApiResponse<Task> = await response.json();
101
102 if (result.success && result.data) {
115 try {
116 setError(null);
117 const response = await fetch(`/api/tasks/${id}`, {
118 method: 'DELETE',
119 });
120
121 const result: ApiResponse<{ deleted: boolean }> = await response.json();
122
123 if (result.success) {

untitled-6073tasks.ts19 matches

@Ayskrmi028โ€ขUpdated 3 months ago
1import { Hono } from "https://esm.sh/hono@3.11.7";
2import { getAllTasks, getTaskById, createTask, updateTask, deleteTask } from "../database/queries.ts";
3import type { CreateTaskRequest, UpdateTaskRequest, ApiResponse } from "../../shared/types.ts";
4
5const tasks = new Hono();
9 try {
10 const allTasks = await getAllTasks();
11 return c.json({ success: true, data: allTasks } as ApiResponse<typeof allTasks>);
12 } catch (error) {
13 return c.json({ success: false, error: "Failed to fetch tasks" } as ApiResponse<never>, 500);
14 }
15});
20 const id = parseInt(c.req.param("id"));
21 if (isNaN(id)) {
22 return c.json({ success: false, error: "Invalid task ID" } as ApiResponse<never>, 400);
23 }
24
25 const task = await getTaskById(id);
26 if (!task) {
27 return c.json({ success: false, error: "Task not found" } as ApiResponse<never>, 404);
28 }
29
30 return c.json({ success: true, data: task } as ApiResponse<typeof task>);
31 } catch (error) {
32 return c.json({ success: false, error: "Failed to fetch task" } as ApiResponse<never>, 500);
33 }
34});
40
41 if (!body.title || body.title.trim().length === 0) {
42 return c.json({ success: false, error: "Task title is required" } as ApiResponse<never>, 400);
43 }
44
45 const newTask = await createTask({ title: body.title.trim() });
46 return c.json({ success: true, data: newTask } as ApiResponse<typeof newTask>, 201);
47 } catch (error) {
48 return c.json({ success: false, error: "Failed to create task" } as ApiResponse<never>, 500);
49 }
50});
55 const id = parseInt(c.req.param("id"));
56 if (isNaN(id)) {
57 return c.json({ success: false, error: "Invalid task ID" } as ApiResponse<never>, 400);
58 }
59
61
62 if (body.title !== undefined && body.title.trim().length === 0) {
63 return c.json({ success: false, error: "Task title cannot be empty" } as ApiResponse<never>, 400);
64 }
65
66 const updatedTask = await updateTask(id, body);
67 if (!updatedTask) {
68 return c.json({ success: false, error: "Task not found" } as ApiResponse<never>, 404);
69 }
70
71 return c.json({ success: true, data: updatedTask } as ApiResponse<typeof updatedTask>);
72 } catch (error) {
73 return c.json({ success: false, error: "Failed to update task" } as ApiResponse<never>, 500);
74 }
75});
80 const id = parseInt(c.req.param("id"));
81 if (isNaN(id)) {
82 return c.json({ success: false, error: "Invalid task ID" } as ApiResponse<never>, 400);
83 }
84
85 const deleted = await deleteTask(id);
86 if (!deleted) {
87 return c.json({ success: false, error: "Task not found" } as ApiResponse<never>, 404);
88 }
89
90 return c.json({ success: true, data: { deleted: true } } as ApiResponse<{ deleted: boolean }>);
91 } catch (error) {
92 return c.json({ success: false, error: "Failed to delete task" } as ApiResponse<never>, 500);
93 }
94});

untitled-6073types.ts1 match

@Ayskrmi028โ€ขUpdated 3 months ago
18}
19
20export interface ApiResponse<T> {
21 success: boolean;
22 data?: T;

untitled-6073README.md7 matches

@Ayskrmi028โ€ขUpdated 3 months ago
15```
16โ”œโ”€โ”€ backend/
17โ”‚ โ”œโ”€โ”€ index.ts # Main Hono API server
18โ”‚ โ”œโ”€โ”€ database/
19โ”‚ โ”‚ โ”œโ”€โ”€ migrations.ts # Database schema
32```
33
34## API Endpoints
35
36- `GET /api/tasks` - Get all tasks
37- `POST /api/tasks` - Create a new task
38- `PUT /api/tasks/:id` - Update a task
39- `DELETE /api/tasks/:id` - Delete a task
40
41## Tech Stack
42
43- **Backend**: Hono (API framework)
44- **Database**: SQLite
45- **Frontend**: React with TypeScript

ffffindex.ts1 match

@hardโ€ขUpdated 3 months ago
22
23// Generate poem endpoint
24app.post("/api/generate-poem", async c => {
25 try {
26 const request: PoemRequest = await c.req.json();

ffffindex.html1 match

@hardโ€ขUpdated 3 months ago
8 <script src="https://esm.town/v/std/catch"></script>
9 <link rel="stylesheet" href="/frontend/style.css">
10 <link href="https://fonts.googleapis.com/css2?family=Crimson+Text:ital,wght@0,400;0,600;1,400&family=Inter:wght@300;400;500&display=swap" rel="stylesheet">
11</head>
12<body>

ffffREADME.md2 matches

@hardโ€ขUpdated 3 months ago
13## Structure
14
15- `backend/index.ts` - Main Hono server with API endpoints
16- `frontend/index.html` - Main HTML template
17- `frontend/index.tsx` - React frontend application
28## Environment Variables
29
30- `OPENAI_API_KEY` - Required for poem generation

todoist-api

@scottscharlโ€ขUpdated 6 hours ago

elevenLabsDialogueTester2 file matches

@dcm31โ€ขUpdated 1 day ago
Public tester for ElevenLabs text-to-dialogue API
fapian
<("<) <(")> (>")>
Kapil01