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=199&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 17972 results for "api"(4044ms)

FindMyCarmatches.ts14 matches

@Saraxxxโ€ขUpdated 3 days ago
1import { Hono } from "https://esm.sh/hono@3.11.7";
2import type { CarMatch, ApiResponse } from "../../shared/types.ts";
3import {
4 getMatches,
39 );
40
41 const response: ApiResponse<any[]> = {
42 success: true,
43 data: enrichedMatches
46 return c.json(response);
47 } catch (error) {
48 const response: ApiResponse<null> = {
49 success: false,
50 error: error instanceof Error ? error.message : "Unknown error occurred"
59 const id = parseInt(c.req.param("id"));
60 if (isNaN(id)) {
61 const response: ApiResponse<null> = {
62 success: false,
63 error: "Invalid match ID"
68 const { status } = await c.req.json();
69 if (!['pending', 'confirmed', 'rejected'].includes(status)) {
70 const response: ApiResponse<null> = {
71 success: false,
72 error: "Invalid status. Must be 'pending', 'confirmed', or 'rejected'"
80
81 if (!match) {
82 const response: ApiResponse<null> = {
83 success: false,
84 error: "Match not found"
95 }
96
97 const response: ApiResponse<null> = {
98 success: true,
99 message: `Match status updated to ${status}${status === 'confirmed' ? '. Car owners have been notified.' : ''}`
102 return c.json(response);
103 } catch (error) {
104 const response: ApiResponse<null> = {
105 success: false,
106 error: error instanceof Error ? error.message : "Unknown error occurred"
115 const stolenCarId = parseInt(c.req.param("stolenCarId"));
116 if (isNaN(stolenCarId)) {
117 const response: ApiResponse<null> = {
118 success: false,
119 error: "Invalid stolen car ID"
135 );
136
137 const response: ApiResponse<any[]> = {
138 success: true,
139 data: enrichedMatches
142 return c.json(response);
143 } catch (error) {
144 const response: ApiResponse<null> = {
145 success: false,
146 error: error instanceof Error ? error.message : "Unknown error occurred"
155 const foundCarId = parseInt(c.req.param("foundCarId"));
156 if (isNaN(foundCarId)) {
157 const response: ApiResponse<null> = {
158 success: false,
159 error: "Invalid found car ID"
175 );
176
177 const response: ApiResponse<any[]> = {
178 success: true,
179 data: enrichedMatches
182 return c.json(response);
183 } catch (error) {
184 const response: ApiResponse<null> = {
185 success: false,
186 error: error instanceof Error ? error.message : "Unknown error occurred"

FindMyCarindex.ts17 matches

@Saraxxxโ€ขUpdated 3 days ago
19await createTables();
20
21// API Routes
22app.route("/api/stolen", stolenRoutes);
23app.route("/api/found", foundRoutes);
24app.route("/api/matches", matchRoutes);
25app.route("/api/search", searchRoutes);
26
27// Health check endpoint
28app.get("/api/health", (c) => {
29 return c.json({
30 status: "healthy",
31 timestamp: new Date().toISOString(),
32 service: "Lost Cars Finder API"
33 });
34});
46 const initialData = {
47 timestamp: new Date().toISOString(),
48 apiBase: "/api"
49 };
50
76 <div class="bg-blue-50 p-4 rounded-lg">
77 <p class="text-sm text-blue-800">
78 API is running at <code>/api</code> -
79 <a href="/api/health" class="underline">Check health</a>
80 </p>
81 </div>
94 error: "Endpoint not found",
95 available_endpoints: [
96 "GET /api/health",
97 "GET /api/stolen",
98 "POST /api/stolen",
99 "GET /api/found",
100 "POST /api/found",
101 "GET /api/matches",
102 "GET /api/search"
103 ]
104 }, 404);

FindMyCarfound.ts18 matches

@Saraxxxโ€ขUpdated 3 days ago
1import { Hono } from "https://esm.sh/hono@3.11.7";
2import type { FoundCar, ApiResponse } from "../../shared/types.ts";
3import {
4 createFoundCarReport,
31 const cars = await getFoundCars(Object.keys(cleanFilters).length > 0 ? cleanFilters : undefined);
32
33 const response: ApiResponse<FoundCar[]> = {
34 success: true,
35 data: cars
38 return c.json(response);
39 } catch (error) {
40 const response: ApiResponse<null> = {
41 success: false,
42 error: error instanceof Error ? error.message : "Unknown error occurred"
51 const id = parseInt(c.req.param("id"));
52 if (isNaN(id)) {
53 const response: ApiResponse<null> = {
54 success: false,
55 error: "Invalid car ID"
60 const car = await getFoundCarById(id);
61 if (!car) {
62 const response: ApiResponse<null> = {
63 success: false,
64 error: "Found car not found"
67 }
68
69 const response: ApiResponse<FoundCar> = {
70 success: true,
71 data: car
74 return c.json(response);
75 } catch (error) {
76 const response: ApiResponse<null> = {
77 success: false,
78 error: error instanceof Error ? error.message : "Unknown error occurred"
92
93 if (missingFields.length > 0) {
94 const response: ApiResponse<null> = {
95 success: false,
96 error: `Missing required fields: ${missingFields.join(', ')}`
152 }
153
154 const response: ApiResponse<FoundCar> = {
155 success: true,
156 data: createdCar!,
160 return c.json(response, 201);
161 } catch (error) {
162 const response: ApiResponse<null> = {
163 success: false,
164 error: error instanceof Error ? error.message : "Unknown error occurred"
173 const id = parseInt(c.req.param("id"));
174 if (isNaN(id)) {
175 const response: ApiResponse<null> = {
176 success: false,
177 error: "Invalid car ID"
182 const { status } = await c.req.json();
183 if (!['active', 'matched', 'resolved'].includes(status)) {
184 const response: ApiResponse<null> = {
185 success: false,
186 error: "Invalid status. Must be 'active', 'matched', or 'resolved'"
192 const existingCar = await getFoundCarById(id);
193 if (!existingCar) {
194 const response: ApiResponse<null> = {
195 success: false,
196 error: "Found car not found"
202 const updatedCar = await getFoundCarById(id);
203
204 const response: ApiResponse<FoundCar> = {
205 success: true,
206 data: updatedCar!,
210 return c.json(response);
211 } catch (error) {
212 const response: ApiResponse<null> = {
213 success: false,
214 error: error instanceof Error ? error.message : "Unknown error occurred"
223 const id = parseInt(c.req.param("id"));
224 if (isNaN(id)) {
225 const response: ApiResponse<null> = {
226 success: false,
227 error: "Invalid car ID"
232 const matches = await findPotentialMatches(id);
233
234 const response: ApiResponse<any[]> = {
235 success: true,
236 data: matches
239 return c.json(response);
240 } catch (error) {
241 const response: ApiResponse<null> = {
242 success: false,
243 error: error instanceof Error ? error.message : "Unknown error occurred"

FindMyCarApp.tsx1 match

@Saraxxxโ€ขUpdated 3 days ago
34 });
35
36 const response = await fetch(`/api/search?${params}`);
37 const data = await response.json();
38

Advertappadvertisements.ts5 matches

@Raj3bโ€ขUpdated 3 days ago
10 User,
11 CreateAdvertisementRequest,
12 ApiResponse,
13 Advertisement,
14 AdvertisementWithLeads
23 const ads = await getAdvertisementsByUser(user.id);
24
25 const response: ApiResponse<Advertisement[]> = {
26 success: true,
27 data: ads
84 };
85
86 const response: ApiResponse<Advertisement> = {
87 success: true,
88 data: responseAd
123 };
124
125 const response: ApiResponse<AdvertisementWithLeads> = {
126 success: true,
127 data: responseAd
158 };
159
160 const response: ApiResponse<typeof responseStats> = {
161 success: true,
162 data: responseStats

untitled-1096Calendar.tsx3 matches

@Ozyโ€ขUpdated 3 days ago
24 const endDate = getViewEndDate();
25
26 const response = await fetch(`/api/events/range?start=${startDate.toISOString()}&end=${endDate.toISOString()}`);
27 const result = await response.json();
28
109
110 try {
111 const response = await fetch(`/api/events/${eventId}`, {
112 method: 'DELETE'
113 });
354 key={mode}
355 onClick={() => setViewMode(mode)}
356 className={`px-3 py-1 text-sm rounded capitalize ${
357 viewMode === mode
358 ? 'bg-blue-600 text-white'

AlxprojectREADME.md8 matches

@Bioluwatife_elusakinโ€ขUpdated 3 days ago
14```
15โ”œโ”€โ”€ backend/
16โ”‚ โ””โ”€โ”€ index.ts # Main API server with OpenAI integration
17โ”œโ”€โ”€ frontend/
18โ”‚ โ”œโ”€โ”€ index.html # Main application interface
33## Technology Stack
34
35- **Backend**: Hono + OpenAI API
36- **Frontend**: React + TailwindCSS
37- **AI**: GPT-4o-mini for concept explanations
38- **Styling**: Custom CSS with gradient backgrounds and animations
39
40## API Endpoints
41
42- `GET /` - Main application interface
43- `POST /api/explain` - Get AI-powered explanations for biostatistics terms
44- `GET /api/health` - Health check endpoint
45- `GET /frontend/*` - Static frontend assets
46- `GET /shared/*` - Shared TypeScript types
68- Comprehensive coverage of biostatistics curriculum
69
70## API Endpoints
71
72- `GET /` - Main application interface
73- `POST /api/explain` - Get AI-powered explanations for biostatistics concepts
74- `GET /api/health` - Health check endpoint
75
76## Example Usage

untitled-1096App.tsx3 matches

@Ozyโ€ขUpdated 3 days ago
32 try {
33 setLoading(true);
34 const response = await fetch('/api/dashboard');
35 const result = await response.json();
36 if (result.success) {
75 const toggleTodoComplete = async (todo: TodoItem) => {
76 try {
77 const response = await fetch(`/api/todos/${todo.id}/toggle`, {
78 method: 'PATCH'
79 });
300
301 try {
302 const url = editingTodo ? `/api/todos/${editingTodo.id}` : '/api/todos';
303 const method = editingTodo ? 'PUT' : 'POST';
304

Alxprojectindex.tsx1 match

@Bioluwatife_elusakinโ€ขUpdated 3 days ago
30
31 try {
32 const response = await fetch("/api/explain", {
33 method: "POST",
34 headers: { "Content-Type": "application/json" },

Advertapptypes.ts2 matches

@Raj3bโ€ขUpdated 3 days ago
19}
20
21export interface ApiResponse<T = any> {
22 success: boolean;
23 data?: T;
100}
101
102// Request/Response types for API
103export interface CreateAdvertisementRequest {
104 title: string;

dailyQuoteAPI

@Soukyโ€ขUpdated 1 day ago

HTTP

@Ncharityโ€ขUpdated 1 day ago
Daily Quote API
Kapil01
apiv1