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/$%7Bart_info.art.src%7D?q=api&page=110&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 17787 results for "api"(1424ms)

untitled-266README.md8 matches

@mmmmโ€ขUpdated 2 days ago
41## Tech Stack
42
43- **Backend**: Hono (API framework)
44- **Database**: SQLite
45- **Frontend**: React with TypeScript
47- **Real-time**: Server-Sent Events (SSE)
48
49## API Endpoints
50
51- `POST /api/auth/register` - Register new user
52- `POST /api/auth/login` - User login
53- `GET /api/users` - Get all users
54- `GET /api/messages` - Get message history
55- `POST /api/messages` - Send new message
56- `GET /api/messages/stream` - SSE endpoint for real-time messages
57
58## Getting Started

Dryrunchat.ts8 matches

@dwish_254โ€ขUpdated 2 days ago
1import { Hono } from "https://esm.sh/hono@3.11.7";
2import { getChatMessages, createChatMessage } from "../database/queries.ts";
3import type { CreateMessageRequest, ApiResponse } from "../../shared/types.ts";
4
5const chat = new Hono();
13 success: true,
14 data: messages
15 } as ApiResponse<typeof messages>);
16 } catch (error) {
17 return c.json({
18 success: false,
19 error: "Failed to fetch messages"
20 } as ApiResponse<never>, 500);
21 }
22});
32 success: false,
33 error: "Username and message are required"
34 } as ApiResponse<never>, 400);
35 }
36
40 success: false,
41 error: "Message too long (max 500 characters)"
42 } as ApiResponse<never>, 400);
43 }
44
48 success: false,
49 error: "Username too long (max 50 characters)"
50 } as ApiResponse<never>, 400);
51 }
52
55 success: true,
56 data: newMessage
57 } as ApiResponse<typeof newMessage>, 201);
58 } catch (error) {
59 return c.json({
60 success: false,
61 error: "Failed to send message"
62 } as ApiResponse<never>, 500);
63 }
64});

soulandfoodindex.html2 matches

@that_girlโ€ขUpdated 2 days ago
22
23 <!-- Fonts -->
24 <link rel="preconnect" href="https://fonts.googleapis.com">
25 <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
26 <link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Playfair+Display:wght@400;500;600;700&display=swap" rel="stylesheet">
27
28 <!-- TailwindCSS -->

Dryrunjobs.ts11 matches

@dwish_254โ€ขUpdated 2 days ago
1import { Hono } from "https://esm.sh/hono@3.11.7";
2import { getAllJobs, createJob, deleteJob } from "../database/queries.ts";
3import type { CreateJobRequest, ApiResponse } from "../../shared/types.ts";
4
5const jobs = new Hono();
12 success: true,
13 data: jobList
14 } as ApiResponse<typeof jobList>);
15 } catch (error) {
16 return c.json({
17 success: false,
18 error: "Failed to fetch jobs"
19 } as ApiResponse<never>, 500);
20 }
21});
32 success: false,
33 error: "Missing required fields"
34 } as ApiResponse<never>, 400);
35 }
36
41 success: false,
42 error: "Invalid email format"
43 } as ApiResponse<never>, 400);
44 }
45
48 success: true,
49 data: newJob
50 } as ApiResponse<typeof newJob>, 201);
51 } catch (error) {
52 return c.json({
53 success: false,
54 error: "Failed to create job"
55 } as ApiResponse<never>, 500);
56 }
57});
65 success: false,
66 error: "Invalid job ID"
67 } as ApiResponse<never>, 400);
68 }
69
73 success: false,
74 error: "Job not found"
75 } as ApiResponse<never>, 404);
76 }
77
79 success: true,
80 data: { id }
81 } as ApiResponse<{ id: number }>);
82 } catch (error) {
83 return c.json({
84 success: false,
85 error: "Failed to delete job"
86 } as ApiResponse<never>, 500);
87 }
88});

soulandfoodREADME.md2 matches

@that_girlโ€ขUpdated 2 days ago
15
16- **Frontend**: React with TypeScript, TailwindCSS
17- **Backend**: Hono API framework
18- **Database**: SQLite for user data and engagement tracking
19- **AI**: OpenAI for mood-based affirmations
32โ”‚ โ”‚ โ”œโ”€โ”€ music.ts # Music suggestion endpoints
33โ”‚ โ”‚ โ””โ”€โ”€ user.ts # User data and favorites
34โ”‚ โ””โ”€โ”€ index.ts # Main API server
35โ”œโ”€โ”€ frontend/
36โ”‚ โ”œโ”€โ”€ components/

Dryruntypes.ts1 match

@dwish_254โ€ขUpdated 2 days ago
37}
38
39export interface ApiResponse<T> {
40 success: boolean;
41 data?: T;

DryrunREADME.md10 matches

@dwish_254โ€ขUpdated 2 days ago
17โ”‚ โ”‚ โ””โ”€โ”€ queries.ts # Database query functions
18โ”‚ โ”œโ”€โ”€ routes/
19โ”‚ โ”‚ โ”œโ”€โ”€ jobs.ts # Job posting API routes
20โ”‚ โ”‚ โ””โ”€โ”€ chat.ts # Chat API routes
21โ”‚ โ””โ”€โ”€ index.ts # Main Hono server
22โ”œโ”€โ”€ frontend/
34## Tech Stack
35
36- **Backend**: Hono (TypeScript API framework)
37- **Database**: SQLite
38- **Frontend**: React with TypeScript
40- **Real-time**: Polling-based chat updates
41
42## API Endpoints
43
44### Jobs
45- `GET /api/jobs` - Get all job postings
46- `POST /api/jobs` - Create a new job posting
47- `DELETE /api/jobs/:id` - Delete a job posting
48
49### Chat
50- `GET /api/chat/messages` - Get chat messages
51- `POST /api/chat/messages` - Send a chat message
52
53## Getting Started
54
55This app runs on Val Town. The backend serves both the API and static frontend files.

CHATBOTmigrations.ts1 match

@fevyโ€ขUpdated 2 days ago
82 id: 'fashion-design-advanced',
83 name: 'Advanced Fashion Design',
84 description: 'Advanced techniques in fashion design, draping, and professional garment construction.',
85 duration: '6 months',
86 fee: 300000,

soulandfooduser.ts32 matches

@that_girlโ€ขUpdated 2 days ago
15 getAppUsageStats
16} from "../database/queries.ts";
17import type { User, UserFavorite, APIResponse } from "../../shared/types.ts";
18
19export const userRoutes = new Hono();
64 });
65
66 return c.json<APIResponse<{ user: User; sessionId: string }>>({
67 success: true,
68 data: { user, sessionId },
72 } catch (error) {
73 console.error('Error initializing user:', error);
74 return c.json<APIResponse<null>>({
75 success: false,
76 error: 'Failed to initialize user'
85
86 if (!userId) {
87 return c.json<APIResponse<null>>({
88 success: false,
89 error: 'User ID is required'
94
95 if (!user) {
96 return c.json<APIResponse<null>>({
97 success: false,
98 error: 'User not found'
100 }
101
102 return c.json<APIResponse<User>>({
103 success: true,
104 data: user
107 } catch (error) {
108 console.error('Error fetching user:', error);
109 return c.json<APIResponse<null>>({
110 success: false,
111 error: 'Failed to fetch user'
122
123 if (!userId || !language) {
124 return c.json<APIResponse<null>>({
125 success: false,
126 error: 'User ID and language are required'
129
130 if (!['en', 'fr'].includes(language)) {
131 return c.json<APIResponse<null>>({
132 success: false,
133 error: 'Language must be "en" or "fr"'
149 }
150
151 return c.json<APIResponse<{ language: string }>>({
152 success: true,
153 data: { language },
157 } catch (error) {
158 console.error('Error updating user language:', error);
159 return c.json<APIResponse<null>>({
160 success: false,
161 error: 'Failed to update language preference'
172
173 if (!userId || !type || !itemId) {
174 return c.json<APIResponse<null>>({
175 success: false,
176 error: 'User ID, type, and item ID are required'
179
180 if (!['recipe', 'music'].includes(type)) {
181 return c.json<APIResponse<null>>({
182 success: false,
183 error: 'Type must be "recipe" or "music"'
205 }
206
207 return c.json<APIResponse<UserFavorite>>({
208 success: true,
209 data: favorite,
213 } catch (error) {
214 console.error('Error adding favorite:', error);
215 return c.json<APIResponse<null>>({
216 success: false,
217 error: 'Failed to add favorite'
228
229 if (!userId || !type || !itemId) {
230 return c.json<APIResponse<null>>({
231 success: false,
232 error: 'User ID, type, and item ID are required'
236 await removeFavorite(userId, type, itemId);
237
238 return c.json<APIResponse<null>>({
239 success: true,
240 message: 'Removed from favorites'
243 } catch (error) {
244 console.error('Error removing favorite:', error);
245 return c.json<APIResponse<null>>({
246 success: false,
247 error: 'Failed to remove favorite'
257
258 if (!userId) {
259 return c.json<APIResponse<null>>({
260 success: false,
261 error: 'User ID is required'
265 const favorites = await getUserFavorites(userId, type);
266
267 return c.json<APIResponse<UserFavorite[]>>({
268 success: true,
269 data: favorites
272 } catch (error) {
273 console.error('Error fetching favorites:', error);
274 return c.json<APIResponse<null>>({
275 success: false,
276 error: 'Failed to fetch favorites'
287
288 if (!userId || !type || !itemId) {
289 return c.json<APIResponse<null>>({
290 success: false,
291 error: 'User ID, type, and item ID are required'
295 const isFav = await isFavorite(userId, type, itemId);
296
297 return c.json<APIResponse<{ isFavorite: boolean }>>({
298 success: true,
299 data: { isFavorite: isFav }
302 } catch (error) {
303 console.error('Error checking favorite status:', error);
304 return c.json<APIResponse<null>>({
305 success: false,
306 error: 'Failed to check favorite status'
317
318 if (!sessionId) {
319 return c.json<APIResponse<null>>({
320 success: false,
321 error: 'Session ID is required'
335 }
336
337 return c.json<APIResponse<null>>({
338 success: true,
339 message: 'Session ended successfully'
342 } catch (error) {
343 console.error('Error ending session:', error);
344 return c.json<APIResponse<null>>({
345 success: false,
346 error: 'Failed to end session'
356
357 if (!userId) {
358 return c.json<APIResponse<null>>({
359 success: false,
360 error: 'User ID is required'
364 const stats = await getUserEngagementStats(userId, days);
365
366 return c.json<APIResponse<any>>({
367 success: true,
368 data: stats
371 } catch (error) {
372 console.error('Error fetching engagement stats:', error);
373 return c.json<APIResponse<null>>({
374 success: false,
375 error: 'Failed to fetch engagement statistics'
384 const stats = await getAppUsageStats(days);
385
386 return c.json<APIResponse<any>>({
387 success: true,
388 data: stats
391 } catch (error) {
392 console.error('Error fetching app usage stats:', error);
393 return c.json<APIResponse<null>>({
394 success: false,
395 error: 'Failed to fetch app usage statistics'

soulandfoodmusic.ts22 matches

@that_girlโ€ขUpdated 2 days ago
2import { musicSuggestions, getMusicByMood, getMusicById, getMusicByGenre, getRandomMusicByMood } from "../../frontend/data/music.ts";
3import { trackEngagement } from "../database/queries.ts";
4import type { MusicSuggestion, APIResponse } from "../../shared/types.ts";
5
6export const musicRoutes = new Hono();
9musicRoutes.get('/', async (c) => {
10 try {
11 return c.json<APIResponse<MusicSuggestion[]>>({
12 success: true,
13 data: musicSuggestions
15 } catch (error) {
16 console.error('Error fetching music suggestions:', error);
17 return c.json<APIResponse<null>>({
18 success: false,
19 error: 'Failed to fetch music suggestions'
32
33 if (!mood) {
34 return c.json<APIResponse<null>>({
35 success: false,
36 error: 'Mood parameter is required'
58 }
59
60 return c.json<APIResponse<MusicSuggestion[]>>({
61 success: true,
62 data: moodMusic,
66 } catch (error) {
67 console.error('Error fetching music by mood:', error);
68 return c.json<APIResponse<null>>({
69 success: false,
70 error: 'Failed to fetch music by mood'
81
82 if (!id) {
83 return c.json<APIResponse<null>>({
84 success: false,
85 error: 'Music ID is required'
90
91 if (!music) {
92 return c.json<APIResponse<null>>({
93 success: false,
94 error: 'Music not found'
108 }
109
110 return c.json<APIResponse<MusicSuggestion>>({
111 success: true,
112 data: music
115 } catch (error) {
116 console.error('Error fetching music:', error);
117 return c.json<APIResponse<null>>({
118 success: false,
119 error: 'Failed to fetch music'
128
129 if (!genre) {
130 return c.json<APIResponse<null>>({
131 success: false,
132 error: 'Genre parameter is required'
136 const genreMusic = getMusicByGenre(genre);
137
138 return c.json<APIResponse<MusicSuggestion[]>>({
139 success: true,
140 data: genreMusic,
144 } catch (error) {
145 console.error('Error fetching music by genre:', error);
146 return c.json<APIResponse<null>>({
147 success: false,
148 error: 'Failed to fetch music by genre'
195 const recommendations = filteredMusic.slice(0, 8);
196
197 return c.json<APIResponse<MusicSuggestion[]>>({
198 success: true,
199 data: recommendations,
203 } catch (error) {
204 console.error('Error generating music recommendations:', error);
205 return c.json<APIResponse<null>>({
206 success: false,
207 error: 'Failed to generate music recommendations'
233 const randomMusic = shuffled.slice(0, Math.min(count, availableMusic.length));
234
235 return c.json<APIResponse<MusicSuggestion[]>>({
236 success: true,
237 data: randomMusic,
241 } catch (error) {
242 console.error('Error fetching random music:', error);
243 return c.json<APIResponse<null>>({
244 success: false,
245 error: 'Failed to fetch random music'
261 });
262
263 return c.json<APIResponse<{
264 genres: string[];
265 culturalOrigins: string[];
278 } catch (error) {
279 console.error('Error fetching music metadata:', error);
280 return c.json<APIResponse<null>>({
281 success: false,
282 error: 'Failed to fetch music metadata'
292
293 if (!moods || !Array.isArray(moods) || moods.length === 0) {
294 return c.json<APIResponse<null>>({
295 success: false,
296 error: 'Moods array is required'
311 );
312
313 return c.json<APIResponse<{
314 playlist: MusicSuggestion[];
315 totalSongs: number;
329 } catch (error) {
330 console.error('Error creating mood journey playlist:', error);
331 return c.json<APIResponse<null>>({
332 success: false,
333 error: 'Failed to create mood journey playlist'

dailyQuoteAPI

@Soukyโ€ขUpdated 7 hours ago

HTTP

@Ncharityโ€ขUpdated 10 hours ago
Daily Quote API
apiry
Kapil01