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/?q=api&page=304&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 15454 results for "api"(1774ms)

dddindex.ts27 matches

@Dhanuโ€ขUpdated 2 weeks ago
38 .catch(console.error);
39
40// API routes
41
42// Auth routes
43app.post("/api/auth/login", async (c) => {
44 const body = await c.req.json();
45 const { email, password } = body;
58});
59
60app.post("/api/auth/register", async (c) => {
61 const body = await c.req.json();
62 const { name, email, password } = body;
75});
76
77app.get("/api/auth/me", authenticate, async (c) => {
78 const user = c.get("user");
79 return c.json({ success: true, data: user });
81
82// Property routes
83app.get("/api/properties", async (c) => {
84 const page = parseInt(c.req.query("page") || "1");
85 const limit = parseInt(c.req.query("limit") || "10");
109});
110
111app.get("/api/properties/featured", async (c) => {
112 const limit = parseInt(c.req.query("limit") || "6");
113
121});
122
123app.get("/api/properties/:id", async (c) => {
124 const id = parseInt(c.req.param("id"));
125
137});
138
139app.post("/api/properties", authenticate, agentOrAdmin, async (c) => {
140 const user = c.get("user");
141 const body = await c.req.json();
155});
156
157app.put("/api/properties/:id", authenticate, agentOrAdmin, async (c) => {
158 const id = parseInt(c.req.param("id"));
159 const user = c.get("user");
180});
181
182app.delete("/api/properties/:id", authenticate, agentOrAdmin, async (c) => {
183 const id = parseInt(c.req.param("id"));
184 const user = c.get("user");
205
206// User routes
207app.get("/api/users", authenticate, adminOnly, async (c) => {
208 try {
209 const users = await userController.getAllUsers();
215});
216
217app.get("/api/users/agents", async (c) => {
218 try {
219 const agents = await userController.getAgents();
225});
226
227app.get("/api/users/:id", authenticate, async (c) => {
228 const id = parseInt(c.req.param("id"));
229 const user = c.get("user");
247});
248
249app.put("/api/users/:id", authenticate, async (c) => {
250 const id = parseInt(c.req.param("id"));
251 const user = c.get("user");
272});
273
274app.post("/api/users/:id/change-password", authenticate, async (c) => {
275 const id = parseInt(c.req.param("id"));
276 const user = c.get("user");
313});
314
315app.delete("/api/users/:id", authenticate, adminOnly, async (c) => {
316 const id = parseInt(c.req.param("id"));
317
335
336// Inquiry routes
337app.post("/api/inquiries", async (c) => {
338 const body = await c.req.json();
339 const { propertyId, name, email, message, phone } = body;
379});
380
381app.get("/api/inquiries", authenticate, agentOrAdmin, async (c) => {
382 const user = c.get("user");
383 const page = parseInt(c.req.query("page") || "1");
395});
396
397app.get("/api/inquiries/my", authenticate, async (c) => {
398 const user = c.get("user");
399
407});
408
409app.get("/api/inquiries/:id", authenticate, agentOrAdmin, async (c) => {
410 const id = parseInt(c.req.param("id"));
411
423});
424
425app.put("/api/inquiries/:id/status", authenticate, agentOrAdmin, async (c) => {
426 const id = parseInt(c.req.param("id"));
427 const user = c.get("user");
453});
454
455app.delete("/api/inquiries/:id", authenticate, agentOrAdmin, async (c) => {
456 const id = parseInt(c.req.param("id"));
457 const user = c.get("user");
478
479// Favorite routes
480app.post("/api/favorites/:propertyId", authenticate, async (c) => {
481 const propertyId = parseInt(c.req.param("propertyId"));
482 const user = c.get("user");
500});
501
502app.delete("/api/favorites/:propertyId", authenticate, async (c) => {
503 const propertyId = parseInt(c.req.param("propertyId"));
504 const user = c.get("user");
522});
523
524app.get("/api/favorites", authenticate, async (c) => {
525 const user = c.get("user");
526
534});
535
536app.get("/api/favorites/check/:propertyId", authenticate, async (c) => {
537 const propertyId = parseInt(c.req.param("propertyId"));
538 const user = c.get("user");
552
553// Dashboard routes
554app.get("/api/dashboard", authenticate, agentOrAdmin, async (c) => {
555 const user = c.get("user");
556

untitled-3483README.md6 matches

@Satheesh_25โ€ขUpdated 2 weeks ago
5## Structure
6
7- `index.ts` - Main entry point and API routes using Hono framework
8- `database/` - Database setup, migrations, and queries
9
10## API Endpoints
11
12- `GET /api/categories` - Get all product categories
13- `GET /api/products` - Get products with optional filtering
14 - Query params: `featured`, `category`, `limit`, `search`
15- `GET /api/products/:slug` - Get a single product by slug
16- `GET /api/featured` - Get featured products
17
18## Page Routes

untitled-3483index.ts8 matches

@Satheesh_25โ€ขUpdated 2 weeks ago
30const viewSourceUrl = projectInfo.links.self.project;
31
32// API Routes
33const api = new Hono();
34
35// Get all categories
36api.get("/categories", async (c) => {
37 const categories = await getCategories();
38 return c.json(categories);
40
41// Get products with optional filtering
42api.get("/products", async (c) => {
43 const { featured, category, limit, search } = c.req.query();
44
67
68// Get a single product by slug
69api.get("/products/:slug", async (c) => {
70 const slug = c.req.param("slug");
71 const product = await getProductBySlug(slug);
79
80// Get featured products
81api.get("/featured", async (c) => {
82 const limit = c.req.query("limit");
83 const products = await getFeaturedProducts(limit ? parseInt(limit) : 6);
85});
86
87// Mount API routes
88app.route("/api", api);
89
90// Serve static files

untitled-3483index.js1 match

@Satheesh_25โ€ขUpdated 2 weeks ago
700
701 try {
702 const response = await fetch(`/api/products?search=${encodeURIComponent(query)}`);
703 const products = await response.json();
704

untitled-3483README.md1 match

@Satheesh_25โ€ขUpdated 2 weeks ago
14## Project Structure
15
16- `backend/index.ts` - Main HTTP entry point and API routes
17- `backend/database/` - Database setup and queries
18- `frontend/` - All frontend assets (HTML, CSS, JS)

dddtypes.ts2 matches

@Dhanuโ€ขUpdated 2 weeks ago
131}
132
133// API Response types
134export interface ApiResponse<T> {
135 success: boolean;
136 data?: T;

dddREADME.md2 matches

@Dhanuโ€ขUpdated 2 weeks ago
17
18- **Frontend**: React with TailwindCSS
19- **Backend**: Hono API framework on Val Town
20- **Database**: SQLite for data storage
21- **Authentication**: JWT-based authentication
71โ”‚ โ”‚ โ””โ”€โ”€ ...
72โ”‚ โ”œโ”€โ”€ utils/
73โ”‚ โ”‚ โ”œโ”€โ”€ api.ts
74โ”‚ โ”‚ โ””โ”€โ”€ helpers.ts
75โ”‚ โ”œโ”€โ”€ index.html

dddApp.tsx4 matches

@Dhanuโ€ขUpdated 2 weeks ago
21
22 try {
23 const response = await fetch(`/api/weather/${encodeURIComponent(location)}`);
24
25 if (!response.ok) {
43 const fetchRecentSearches = async () => {
44 try {
45 const response = await fetch("/api/history");
46 if (response.ok) {
47 const data = await response.json();
55 const clearSearchHistory = async () => {
56 try {
57 const response = await fetch("/api/history", {
58 method: "DELETE"
59 });
102
103 <footer className="mt-12 text-center text-white text-opacity-70 text-sm">
104 <p>Data provided by Open-Meteo API</p>
105 <p className="mt-1">
106 <a

dddweather.ts4 matches

@Dhanuโ€ขUpdated 2 weeks ago
2import type { WeatherData, CurrentWeather, ForecastDay, Location } from "../shared/types.ts";
3
4// Geocoding API to get coordinates from location name
5export async function getCoordinates(locationName: string): Promise<Location | null> {
6 try {
7 const response = await fetch(
8 `https://geocoding-api.open-meteo.com/v1/search?name=${encodeURIComponent(locationName)}&count=1&language=en&format=json`
9 );
10
28}
29
30// Fetch current weather and forecast data from Open-Meteo API
31export async function getWeatherData(latitude: number, longitude: number): Promise<WeatherData | null> {
32 try {
33 const response = await fetch(
34 `https://api.open-meteo.com/v1/forecast?latitude=${latitude}&longitude=${longitude}&current=temperature_2m,relative_humidity_2m,weather_code,wind_speed_10m,wind_direction_10m&daily=weather_code,temperature_2m_max,temperature_2m_min,sunrise,sunset,precipitation_sum&timezone=auto&forecast_days=4`
35 );
36

CrazyTestValREADME.md3 matches

@MadLabโ€ขUpdated 2 weeks ago
6- Serving HTML content
7- Client-side JavaScript
8- API integration
9- Basic UI with TailwindCSS
10
16## Features
17
181. **Current Time API**: Fetches the current server time from a backend API endpoint
192. **Click Counter**: Simple client-side counter with increment and reset functionality
203. **Responsive Design**: Mobile-friendly layout using TailwindCSS
22## How to Use
23
241. Click the "Get Current Time" button to fetch the current server time from the API
252. Use the increment and reset buttons to manage the counter
263. View the source code by clicking the "View Source" link

HN-fetch-call2 file matches

@ImGqbโ€ขUpdated 1 day ago
fetch HackerNews by API

token-server1 file match

@kwhinnery_openaiโ€ขUpdated 3 days ago
Mint tokens to use with the OpenAI Realtime API for WebRTC
Kapil01
apiv1