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=197&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 17852 results for "api"(2176ms)

ShippingrevolutionApp.tsx1 match

@Shsragabโ€ขUpdated 3 days ago
29 const loadDashboardStats = async () => {
30 try {
31 const response = await fetch('/api/tracking/dashboard/stats');
32 const result = await response.json();
33 if (result.success) {

untitled-5154README.md1 match

@Heshuwellโ€ขUpdated 3 days ago
39## Tech Stack
40
41- **Backend**: Hono (TypeScript API framework)
42- **Frontend**: React with TypeScript
43- **Database**: SQLite

untitled-1512index.ts3 matches

@Lucyโ€ขUpdated 3 days ago
15await runMigrations();
16
17// API routes
18app.route("/api/jobs", jobsRouter);
19app.route("/api/chat", chatRouter);
20
21// Serve static files

untitled-1512ChatRoom.tsx2 matches

@Lucyโ€ขUpdated 3 days ago
41 const fetchMessages = async () => {
42 try {
43 const response = await fetch('/api/chat/messages');
44 const result = await response.json();
45
64
65 try {
66 const response = await fetch('/api/chat/messages', {
67 method: 'POST',
68 headers: {

untitled-1512JobBoard.tsx2 matches

@Lucyโ€ขUpdated 3 days ago
16 const fetchJobs = async () => {
17 try {
18 const response = await fetch('/api/jobs');
19 const result = await response.json();
20
42
43 try {
44 const response = await fetch(`/api/jobs/${jobId}`, {
45 method: 'DELETE',
46 });

townBusList.tsx1 match

@twambieโ€ขUpdated 3 days ago
18 setDeletingId(id);
19 try {
20 const response = await fetch(`/api/buses/${id}`, {
21 method: "DELETE",
22 });

untitled-1512JobForm.tsx1 match

@Lucyโ€ขUpdated 3 days ago
26
27 try {
28 const response = await fetch('/api/jobs', {
29 method: 'POST',
30 headers: {

townBusForm.tsx1 match

@twambieโ€ขUpdated 3 days ago
29
30 try {
31 const response = await fetch("/api/buses", {
32 method: "POST",
33 headers: {

townREADME.md6 matches

@twambieโ€ขUpdated 3 days ago
19โ”‚ โ”‚ โ””โ”€โ”€ queries.ts # Database query functions
20โ”‚ โ”œโ”€โ”€ routes/
21โ”‚ โ”‚ โ””โ”€โ”€ businesses.ts # Business-related API endpoints
22โ”‚ โ””โ”€โ”€ index.ts # Main Hono server entry point
23โ”œโ”€โ”€ frontend/
33```
34
35## API Endpoints
36
37- `GET /api/businesses` - Get all posted businesses
38- `POST /api/businesses` - Post a new business
39- `DELETE /api/businesses/:id` - Delete a business post
40- `GET /api/businesses/search?q=term` - Search businesses
41
42## Getting Started

untitled-1512chat.ts9 matches

@Lucyโ€ขUpdated 3 days ago
1import { Hono } from "https://esm.sh/hono@3.11.7";
2import { getRecentMessages, createMessage } from "../database/queries.ts";
3import type { ChatMessage, ApiResponse } from "../../shared/types.ts";
4
5const chat = new Hono();
9 try {
10 const messages = await getRecentMessages(50);
11 const response: ApiResponse<ChatMessage[]> = {
12 success: true,
13 data: messages
15 return c.json(response);
16 } catch (error) {
17 const response: ApiResponse<ChatMessage[]> = {
18 success: false,
19 error: "Failed to fetch messages"
30 // Validate required fields
31 if (!body.username || body.username.trim() === '') {
32 const response: ApiResponse<ChatMessage> = {
33 success: false,
34 error: "Username is required"
38
39 if (!body.message || body.message.trim() === '') {
40 const response: ApiResponse<ChatMessage> = {
41 success: false,
42 error: "Message is required"
47 // Limit message length
48 if (body.message.trim().length > 500) {
49 const response: ApiResponse<ChatMessage> = {
50 success: false,
51 error: "Message too long (max 500 characters)"
56 // Limit username length
57 if (body.username.trim().length > 50) {
58 const response: ApiResponse<ChatMessage> = {
59 success: false,
60 error: "Username too long (max 50 characters)"
68 });
69
70 const response: ApiResponse<ChatMessage> = {
71 success: true,
72 data: newMessage
74 return c.json(response, 201);
75 } catch (error) {
76 const response: ApiResponse<ChatMessage> = {
77 success: false,
78 error: "Failed to send message"

dailyQuoteAPI

@Soukyโ€ขUpdated 1 day ago

HTTP

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