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=214&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 18269 results for "api"(931ms)

Freelancingjobs.ts30 matches

@Sandra_Ozumbaโ€ขUpdated 5 days ago
9 getJobApplications
10} from "../database/queries.ts";
11import type { ApiResponse, Job, JobApplication } from "../../shared/types.ts";
12
13const jobs = new Hono();
24 const jobsList = await getJobs(filters);
25
26 return c.json<ApiResponse<Job[]>>({
27 success: true,
28 data: jobsList
31 } catch (error) {
32 console.error("Get jobs error:", error);
33 return c.json<ApiResponse>({
34 success: false,
35 error: "Failed to fetch jobs"
44
45 if (isNaN(id)) {
46 return c.json<ApiResponse>({
47 success: false,
48 error: "Invalid job ID"
53
54 if (!job) {
55 return c.json<ApiResponse>({
56 success: false,
57 error: "Job not found"
59 }
60
61 return c.json<ApiResponse<Job>>({
62 success: true,
63 data: job
66 } catch (error) {
67 console.error("Get job error:", error);
68 return c.json<ApiResponse>({
69 success: false,
70 error: "Failed to fetch job"
82
83 if (!title || !description || !budget_type || !skills_required) {
84 return c.json<ApiResponse>({
85 success: false,
86 error: "Missing required fields"
89
90 if (!['fixed', 'hourly'].includes(budget_type)) {
91 return c.json<ApiResponse>({
92 success: false,
93 error: "Invalid budget type"
103 }
104 } catch (e) {
105 return c.json<ApiResponse>({
106 success: false,
107 error: "Skills required must be a valid array"
120 });
121
122 return c.json<ApiResponse<Job>>({
123 success: true,
124 data: job
127 } catch (error) {
128 console.error("Create job error:", error);
129 return c.json<ApiResponse>({
130 success: false,
131 error: "Failed to create job"
141
142 if (isNaN(id)) {
143 return c.json<ApiResponse>({
144 success: false,
145 error: "Invalid job ID"
149 const job = await getJobById(id);
150 if (!job) {
151 return c.json<ApiResponse>({
152 success: false,
153 error: "Job not found"
157 // Only job owner can update
158 if (job.client_id !== currentUser.userId) {
159 return c.json<ApiResponse>({
160 success: false,
161 error: "Unauthorized"
176 updates.skills_required = JSON.stringify(skillsArray);
177 } catch (e) {
178 return c.json<ApiResponse>({
179 success: false,
180 error: "Skills required must be a valid array"
185 const updatedJob = await updateJob(id, updates);
186
187 return c.json<ApiResponse<Job>>({
188 success: true,
189 data: updatedJob
192 } catch (error) {
193 console.error("Update job error:", error);
194 return c.json<ApiResponse>({
195 success: false,
196 error: "Failed to update job"
206
207 if (isNaN(jobId)) {
208 return c.json<ApiResponse>({
209 success: false,
210 error: "Invalid job ID"
214 const job = await getJobById(jobId);
215 if (!job) {
216 return c.json<ApiResponse>({
217 success: false,
218 error: "Job not found"
221
222 if (job.status !== 'open') {
223 return c.json<ApiResponse>({
224 success: false,
225 error: "Job is not open for applications"
230
231 if (!proposal) {
232 return c.json<ApiResponse>({
233 success: false,
234 error: "Proposal is required"
243 });
244
245 return c.json<ApiResponse<JobApplication>>({
246 success: true,
247 data: application
251 console.error("Apply to job error:", error);
252 if (error.message?.includes("UNIQUE constraint failed")) {
253 return c.json<ApiResponse>({
254 success: false,
255 error: "You have already applied to this job"
256 }, 409);
257 }
258 return c.json<ApiResponse>({
259 success: false,
260 error: "Failed to apply to job"
270
271 if (isNaN(jobId)) {
272 return c.json<ApiResponse>({
273 success: false,
274 error: "Invalid job ID"
278 const job = await getJobById(jobId);
279 if (!job) {
280 return c.json<ApiResponse>({
281 success: false,
282 error: "Job not found"
286 // Only job owner can view applications
287 if (job.client_id !== currentUser.userId) {
288 return c.json<ApiResponse>({
289 success: false,
290 error: "Unauthorized"
294 const applications = await getJobApplications(jobId);
295
296 return c.json<ApiResponse<JobApplication[]>>({
297 success: true,
298 data: applications
301 } catch (error) {
302 console.error("Get job applications error:", error);
303 return c.json<ApiResponse>({
304 success: false,
305 error: "Failed to fetch applications"

Freelancingusers.ts12 matches

@Sandra_Ozumbaโ€ขUpdated 5 days ago
2import { authMiddleware } from "./auth.ts";
3import { getUserById, updateUser, getFreelancers } from "../database/queries.ts";
4import type { ApiResponse, User } from "../../shared/types.ts";
5
6const users = new Hono();
12
13 if (isNaN(id)) {
14 return c.json<ApiResponse>({
15 success: false,
16 error: "Invalid user ID"
21
22 if (!user) {
23 return c.json<ApiResponse>({
24 success: false,
25 error: "User not found"
30 const { password_hash: _, ...userResponse } = user;
31
32 return c.json<ApiResponse<User>>({
33 success: true,
34 data: userResponse
37 } catch (error) {
38 console.error("Get user error:", error);
39 return c.json<ApiResponse>({
40 success: false,
41 error: "Failed to fetch user"
51
52 if (isNaN(id)) {
53 return c.json<ApiResponse>({
54 success: false,
55 error: "Invalid user ID"
59 // Users can only update their own profile
60 if (currentUser.userId !== id) {
61 return c.json<ApiResponse>({
62 success: false,
63 error: "Unauthorized"
80
81 if (!updatedUser) {
82 return c.json<ApiResponse>({
83 success: false,
84 error: "User not found"
89 const { password_hash: _, ...userResponse } = updatedUser;
90
91 return c.json<ApiResponse<User>>({
92 success: true,
93 data: userResponse
96 } catch (error) {
97 console.error("Update user error:", error);
98 return c.json<ApiResponse>({
99 success: false,
100 error: "Failed to update user"
115 });
116
117 return c.json<ApiResponse<User[]>>({
118 success: true,
119 data: freelancersResponse
122 } catch (error) {
123 console.error("Get freelancers error:", error);
124 return c.json<ApiResponse>({
125 success: false,
126 error: "Failed to fetch freelancers"

Createajobpostingindex.ts2 matches

@fridayangelaโ€ขUpdated 5 days ago
15await initializeDatabase();
16
17// API routes
18app.route("/api/jobs", jobsRouter);
19
20// Serve static files

Freelancingtypes.ts1 match

@Sandra_Ozumbaโ€ขUpdated 5 days ago
58}
59
60export interface ApiResponse<T = any> {
61 success: boolean;
62 data?: T;

CreateajobpostingApp.tsx3 matches

@fridayangelaโ€ขUpdated 5 days ago
39 const fetchJobs = async (filter?: string) => {
40 try {
41 const url = filter && filter !== 'all' ? `/api/jobs?type=${filter}` : '/api/jobs';
42 const response = await fetch(url);
43 if (!response.ok) throw new Error('Failed to fetch jobs');
57
58 try {
59 const response = await fetch('/api/jobs', {
60 method: 'POST',
61 headers: {
82 const handleDeleteJob = async (id: number) => {
83 try {
84 const response = await fetch(`/api/jobs/${id}`, {
85 method: 'DELETE',
86 });

FreelancingREADME.md12 matches

@Sandra_Ozumbaโ€ขUpdated 5 days ago
43## Tech Stack
44
45- **Backend**: Hono (TypeScript API framework)
46- **Database**: SQLite with Val Town's sqlite service
47- **Frontend**: React 18.2.0 with TypeScript
574. Register as a freelancer or client to get started
58
59## API Endpoints
60
61- `GET /` - Main application
62- `POST /api/auth/register` - User registration
63- `POST /api/auth/login` - User login
64- `GET /api/jobs` - List jobs
65- `POST /api/jobs` - Create job posting
66- `GET /api/users/:id` - Get user profile
67- `PUT /api/users/:id` - Update user profile
68- `GET /api/chat/messages` - Get chat messages
69- `POST /api/chat/messages` - Send chat message
70- `GET /api/chat/stream` - SSE chat stream
71
72## Environment Variables
73
74No API keys required - uses Val Town's built-in services.

CreateajobpostingREADME.md5 matches

@fridayangelaโ€ขUpdated 5 days ago
13## Structure
14
15- `backend/` - Hono API server with job CRUD operations
16- `frontend/` - React-based job board interface
17- `shared/` - Shared TypeScript types and utilities
18
19## API Endpoints
20
21- `GET /` - Serve the main application
22- `GET /api/jobs` - Get all jobs (with optional type filter)
23- `POST /api/jobs` - Create a new job posting
24- `DELETE /api/jobs/:id` - Delete a job posting
25
26## Usage

untitled-6759Umain.tsx2 matches

@BOBUโ€ขUpdated 5 days ago
6 // Get coordinates for the city
7 const geoResponse = await fetch(
8 `https://geocoding-api.open-meteo.com/v1/search?name=${encodeURIComponent(city)}&count=1&language=en&format=json`,
9 );
10 const geoData = await geoResponse.json();
19 // Get weather data
20 const weatherResponse = await fetch(
21 `https://api.open-meteo.com/v1/forecast?latitude=${latitude}&longitude=${longitude}&current=temperature_2m,relative_humidity_2m,apparent_temperature,weather_code,wind_speed_10m&daily=weather_code,temperature_2m_max,temperature_2m_min&timezone=auto&forecast_days=5`,
22 );
23 const weatherData = await weatherResponse.json();

templateTwitterAlertREADME.md4 matches

@ahmedashrafโ€ขUpdated 5 days ago
31Refer to [Twitter's search operators](https://socialdata.gitbook.io/docs/twitter-tweets/retrieve-search-results-by-keyword#endpoint-parameters) to fine-tune your query.
32
33### 4. Test API call
34Set `isProd = false` in the code if you are testing, to ensure there are enough tweets to display. <br>
35Toggle it back to `true` when you're ready to run this cron job in production and actuall send notifications.
60
61### NOTE: Usage Limits
62This val uses the SocialData API for Twitter data:
63
64- **Proxies via Val Town's [SocialDataProxy](https://www.val.town/v/stevekrouse/socialDataProxy)**: Limited to 10 cents per day for [**Val Town Pro users**](https://www.val.town/pricing). This API is *only* for Pro users.
65- **Need more calls?** Sign up for your own [SocialData API token](https://socialdata.tools) and configure the [`socialDataSearch`](https://www.val.town/v/stevekrouse/socialDataSearch) function.

untitled-5321README.md5 matches

@Lyteโ€ขUpdated 5 days ago
13```
14โ”œโ”€โ”€ backend/
15โ”‚ โ””โ”€โ”€ index.ts # Main Hono server with API routes
16โ”œโ”€โ”€ frontend/
17โ”‚ โ”œโ”€โ”€ components/
27```
28
29## API Endpoints
30
31- `GET /` - Serves the main application
32- `POST /api/chat` - Handles chat/question requests
33- `POST /api/generate-image` - Handles image generation requests
34
35## Environment Variables
36
37- `OPENAI_API_KEY` - Required for OpenAI API access (automatically configured in Val Town)
38
39## Usage

github-api1 file match

@cricks_unmixed4uโ€ขUpdated 6 hours ago

beeminder-api4 file matches

@cricks_unmixed4uโ€ขUpdated 7 hours ago
Kapil01
apiv1