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=198&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 17967 results for "api"(3342ms)

FindMyCartypes.ts1 match

@Saraxxx•Updated 3 days ago
69}
70
71export interface ApiResponse<T> {
72 success: boolean;
73 data?: T;

FindMyCarstolen.ts15 matches

@Saraxxx•Updated 3 days ago
1import { Hono } from "https://esm.sh/hono@3.11.7";
2import type { StolenCar, ApiResponse } from "../../shared/types.ts";
3import {
4 createStolenCarReport,
29 const cars = await getStolenCars(Object.keys(cleanFilters).length > 0 ? cleanFilters : undefined);
30
31 const response: ApiResponse<StolenCar[]> = {
32 success: true,
33 data: cars
36 return c.json(response);
37 } catch (error) {
38 const response: ApiResponse<null> = {
39 success: false,
40 error: error instanceof Error ? error.message : "Unknown error occurred"
49 const id = parseInt(c.req.param("id"));
50 if (isNaN(id)) {
51 const response: ApiResponse<null> = {
52 success: false,
53 error: "Invalid car ID"
58 const car = await getStolenCarById(id);
59 if (!car) {
60 const response: ApiResponse<null> = {
61 success: false,
62 error: "Stolen car not found"
65 }
66
67 const response: ApiResponse<StolenCar> = {
68 success: true,
69 data: car
72 return c.json(response);
73 } catch (error) {
74 const response: ApiResponse<null> = {
75 success: false,
76 error: error instanceof Error ? error.message : "Unknown error occurred"
90
91 if (missingFields.length > 0) {
92 const response: ApiResponse<null> = {
93 success: false,
94 error: `Missing required fields: ${missingFields.join(', ')}`
105 const createdCar = await getStolenCarById(carId);
106
107 const response: ApiResponse<StolenCar> = {
108 success: true,
109 data: createdCar!,
113 return c.json(response, 201);
114 } catch (error) {
115 const response: ApiResponse<null> = {
116 success: false,
117 error: error instanceof Error ? error.message : "Unknown error occurred"
126 const id = parseInt(c.req.param("id"));
127 if (isNaN(id)) {
128 const response: ApiResponse<null> = {
129 success: false,
130 error: "Invalid car ID"
135 const { status } = await c.req.json();
136 if (!['active', 'found', 'resolved'].includes(status)) {
137 const response: ApiResponse<null> = {
138 success: false,
139 error: "Invalid status. Must be 'active', 'found', or 'resolved'"
145 const existingCar = await getStolenCarById(id);
146 if (!existingCar) {
147 const response: ApiResponse<null> = {
148 success: false,
149 error: "Stolen car not found"
155 const updatedCar = await getStolenCarById(id);
156
157 const response: ApiResponse<StolenCar> = {
158 success: true,
159 data: updatedCar!,
163 return c.json(response);
164 } catch (error) {
165 const response: ApiResponse<null> = {
166 success: false,
167 error: error instanceof Error ? error.message : "Unknown error occurred"

FindMyCarsearch.ts6 matches

@Saraxxx•Updated 3 days ago
1import { Hono } from "https://esm.sh/hono@3.11.7";
2import type { SearchFilters, ApiResponse } from "../../shared/types.ts";
3import { searchAllCars } from "../database/queries.ts";
4
26 const results = await searchAllCars(cleanFilters);
27
28 const response: ApiResponse<any> = {
29 success: true,
30 data: {
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"
53
54 if (!field || !['make', 'model', 'color'].includes(field)) {
55 const response: ApiResponse<null> = {
56 success: false,
57 error: "Invalid field. Must be 'make', 'model', or 'color'"
83 ).slice(0, 10);
84
85 const response: ApiResponse<string[]> = {
86 success: true,
87 data: filtered
90 return c.json(response);
91 } catch (error) {
92 const response: ApiResponse<null> = {
93 success: false,
94 error: error instanceof Error ? error.message : "Unknown error occurred"

FindMyCarReportStolen.tsx1 match

@Saraxxx•Updated 3 days ago
21
22 try {
23 const response = await fetch('/api/stolen', {
24 method: 'POST',
25 headers: {

FindMyCarReportFound.tsx1 match

@Saraxxx•Updated 3 days ago
21
22 try {
23 const response = await fetch('/api/found', {
24 method: 'POST',
25 headers: {

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

dailyQuoteAPI

@Souky•Updated 1 day ago

HTTP

@Ncharity•Updated 1 day ago
Daily Quote API
Kapil01
apiv1