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=207&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 18170 results for "api"(5861ms)

LindaREADME.md9 matches

@Lindsey12โ€ขUpdated 5 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/
32```
33
34## API Endpoints
35
36### Jobs
37- `GET /api/jobs` - Get all job postings
38- `POST /api/jobs` - Create a new job posting
39- `DELETE /api/jobs/:id` - Delete a job posting
40
41### Chat
42- `GET /api/chat/messages` - Get recent chat messages
43- `POST /api/chat/messages` - Send a new chat message
44
45## Database Schema
63## Getting Started
64
65This app runs on Val Town. The backend serves both the API and the frontend files.
66
67Visit the HTTP endpoint to access the application.

Jobpostingsjobs.ts15 matches

@Ntando123โ€ขUpdated 5 days ago
1import { Hono } from "https://esm.sh/hono@3.11.7";
2import { getAllJobs, getJobById, createJob, deleteJob } from "../database/queries.ts";
3import type { CreateJobRequest, ApiResponse } from "../../shared/types.ts";
4
5const jobs = new Hono();
9 try {
10 const jobList = await getAllJobs();
11 return c.json({ success: true, data: jobList } as ApiResponse<typeof jobList>);
12 } catch (error) {
13 return c.json({ success: false, error: "Failed to fetch jobs" } 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 job ID" } as ApiResponse<never>, 400);
23 }
24
25 const job = await getJobById(id);
26 if (!job) {
27 return c.json({ success: false, error: "Job not found" } as ApiResponse<never>, 404);
28 }
29
30 return c.json({ success: true, data: job } as ApiResponse<typeof job>);
31 } catch (error) {
32 return c.json({ success: false, error: "Failed to fetch job" } as ApiResponse<never>, 500);
33 }
34});
44 success: false,
45 error: "Missing required fields: title, company, description, requirements, type"
46 } as ApiResponse<never>, 400);
47 }
48
53 success: false,
54 error: "Invalid job type. Must be one of: " + validTypes.join(', ')
55 } as ApiResponse<never>, 400);
56 }
57
58 const newJob = await createJob(body);
59 return c.json({ success: true, data: newJob } as ApiResponse<typeof newJob>, 201);
60 } catch (error) {
61 return c.json({ success: false, error: "Failed to create job" } as ApiResponse<never>, 500);
62 }
63});
68 const id = parseInt(c.req.param("id"));
69 if (isNaN(id)) {
70 return c.json({ success: false, error: "Invalid job ID" } as ApiResponse<never>, 400);
71 }
72
73 const deleted = await deleteJob(id);
74 if (!deleted) {
75 return c.json({ success: false, error: "Job not found" } as ApiResponse<never>, 404);
76 }
77
78 return c.json({ success: true, data: { deleted: true } } as ApiResponse<{ deleted: boolean }>);
79 } catch (error) {
80 return c.json({ success: false, error: "Failed to delete job" } as ApiResponse<never>, 500);
81 }
82});

Jobpostingstypes.ts1 match

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

JobpostingsREADME.md3 matches

@Ntando123โ€ขUpdated 5 days ago
18โ”‚ โ”‚ โ””โ”€โ”€ queries.ts # Database query functions
19โ”‚ โ”œโ”€โ”€ routes/
20โ”‚ โ”‚ โ”œโ”€โ”€ jobs.ts # Job posting API routes
21โ”‚ โ”‚ โ””โ”€โ”€ chat.ts # Chat API routes
22โ”‚ โ””โ”€โ”€ index.ts # Main Hono server
23โ”œโ”€โ”€ frontend/
35## Tech Stack
36
37- **Backend**: Hono (TypeScript API framework)
38- **Database**: SQLite
39- **Frontend**: React with TypeScript

publicindex.ts3 matches

@MrsJDโ€ขUpdated 5 days ago
16await runMigrations();
17
18// API routes
19app.route("/api/cycles", cyclesRoutes);
20app.route("/api/symptoms", symptomsRoutes);
21
22// Serve frontend files

Trackertypes.ts1 match

@Ozyโ€ขUpdated 5 days ago
22}
23
24export interface ApiResponse<T> {
25 success: boolean;
26 data?: T;

Trackertodos.ts7 matches

@Ozyโ€ขUpdated 5 days ago
1import { Hono } from "https://esm.sh/hono@3.11.7";
2import type { TodoItem, ApiResponse } from "../../shared/types.ts";
3import * as queries from "../database/queries.ts";
4
9 try {
10 const todos = await queries.getTodos();
11 return c.json({ success: true, data: todos } as ApiResponse<TodoItem[]>);
12 } catch (error) {
13 return c.json({ success: false, error: error.message }, 500);
19 try {
20 const todos = await queries.getPendingTodos();
21 return c.json({ success: true, data: todos } as ApiResponse<TodoItem[]>);
22 } catch (error) {
23 return c.json({ success: false, error: error.message }, 500);
43
44 const createdTodo = await queries.createTodo(todo);
45 return c.json({ success: true, data: createdTodo } as ApiResponse<TodoItem>, 201);
46 } catch (error) {
47 return c.json({ success: false, error: error.message }, 500);
60 }
61
62 return c.json({ success: true, data: todo } as ApiResponse<TodoItem>);
63 } catch (error) {
64 return c.json({ success: false, error: error.message }, 500);
80
81 const todo = await queries.updateTodo(id, { completed: !currentTodo.completed });
82 return c.json({ success: true, data: todo } as ApiResponse<TodoItem>);
83 } catch (error) {
84 return c.json({ success: false, error: error.message }, 500);
96 }
97
98 return c.json({ success: true } as ApiResponse<null>);
99 } catch (error) {
100 return c.json({ success: false, error: error.message }, 500);

TrackerTodoList.tsx3 matches

@Ozyโ€ขUpdated 5 days ago
21 try {
22 setLoading(true);
23 const response = await fetch('/api/todos');
24 const result = await response.json();
25
36 const toggleTodoComplete = async (todo: TodoItem) => {
37 try {
38 const response = await fetch(`/api/todos/${todo.id}/toggle`, {
39 method: 'PATCH'
40 });
53
54 try {
55 const response = await fetch(`/api/todos/${todoId}`, {
56 method: 'DELETE'
57 });

Trackerindex.ts7 matches

@Ozyโ€ขUpdated 5 days ago
15
16// Initialize database endpoint
17app.get("/api/init", async (c) => {
18 try {
19 await runMigrations();
24});
25
26// API routes
27app.route("/api/events", eventsRouter);
28app.route("/api/todos", todosRouter);
29
30// Dashboard data endpoint
31app.get("/api/dashboard", async (c) => {
32 try {
33 // Try to initialize database if not already done
102 html = html.replace("</head>", `${dataScript}</head>`);
103 } catch (dataError) {
104 console.log("Could not load initial data, app will load it via API:", dataError.message);
105 // App will load data via API instead
106 }
107

Trackerevents.ts6 matches

@Ozyโ€ขUpdated 5 days ago
1import { Hono } from "https://esm.sh/hono@3.11.7";
2import type { ScheduleEvent, ApiResponse } from "../../shared/types.ts";
3import * as queries from "../database/queries.ts";
4
9 try {
10 const events = await queries.getEvents();
11 return c.json({ success: true, data: events } as ApiResponse<ScheduleEvent[]>);
12 } catch (error) {
13 return c.json({ success: false, error: error.message }, 500);
26
27 const events = await queries.getEventsByDateRange(startDate, endDate);
28 return c.json({ success: true, data: events } as ApiResponse<ScheduleEvent[]>);
29 } catch (error) {
30 return c.json({ success: false, error: error.message }, 500);
43
44 const event = await queries.createEvent(eventData);
45 return c.json({ success: true, data: event } as ApiResponse<ScheduleEvent>, 201);
46 } catch (error) {
47 return c.json({ success: false, error: error.message }, 500);
60 }
61
62 return c.json({ success: true, data: event } as ApiResponse<ScheduleEvent>);
63 } catch (error) {
64 return c.json({ success: false, error: error.message }, 500);
76 }
77
78 return c.json({ success: true } as ApiResponse<null>);
79 } catch (error) {
80 return c.json({ success: false, error: error.message }, 500);

xxxclearinghouse_validator

@toowiredโ€ขUpdated 6 hours ago
Request validator for clearance API

Apiify11 file matches

@wolfโ€ขUpdated 1 day ago
snartapi
apiry