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=118&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 13543 results for "api"(879ms)

dhruvindex.ts2 matches

@dhruv•Updated 5 days ago
27});
28
29// API endpoint to get content suggestions
30app.get("/api/suggestions", async (c) => {
31 try {
32 // Get Twitter user ID from environment variable

dhruvindex.html1 match

@dhruv•Updated 5 days ago
82 async function fetchSuggestions() {
83 try {
84 const response = await fetch('/api/suggestions');
85
86 if (!response.ok) {

dhruvtwitter.ts5 matches

@dhruv•Updated 5 days ago
1// Twitter API integration
2
3interface Tweet {
24
25 if (!bearerToken) {
26 throw new Error("Twitter API bearer token not configured");
27 }
28
29 // Twitter API v2 endpoint for user tweets
30 const url = new URL(`https://api.twitter.com/2/users/${userId}/tweets`);
31
32 // Set query parameters
44 if (!response.ok) {
45 const errorText = await response.text();
46 throw new Error(`Twitter API error: ${response.status} ${errorText}`);
47 }
48

dhruvREADME.md3 matches

@dhruv•Updated 5 days ago
12## Setup
13
141. Create Twitter API credentials at [Twitter Developer Portal](https://developer.twitter.com/en/portal/dashboard)
152. Set the following environment variables in Val Town:
16 - `TWITTER_BEARER_TOKEN`: Your Twitter API bearer token
17 - `TWITTER_USER_ID`: Your Twitter user ID (numeric ID, not username)
18
28
29- `index.ts`: Main HTTP endpoint and UI server
30- `twitter.ts`: Twitter API integration
31- `analyzer.ts`: Tweet analysis logic
32- `suggestions.ts`: AI-powered content suggestion generator

MobileTestingindex.ts5 matches

@nbbaier•Updated 5 days ago
42});
43
44// API Routes
45// Get all todos
46app.get("/api/todos", async c => {
47 const todos = await sqlite.execute<Todo>(`SELECT * FROM ${TABLE_NAME} ORDER BY createdAt DESC`);
48 return c.json(todos);
50
51// Create a new todo
52app.post("/api/todos", async c => {
53 const { text } = await c.req.json();
54
67
68// Update a todo
69app.put("/api/todos/:id", async c => {
70 const id = c.req.param('id');
71 const { text, completed } = await c.req.json();
93
94// Delete a todo
95app.delete("/api/todos/:id", async c => {
96 const id = c.req.param('id');
97 await sqlite.execute(`DELETE FROM ${TABLE_NAME} WHERE id = ?`, [id]);

MobileTestingindex.html6 matches

@nbbaier•Updated 5 days ago
104 const saveEditBtn = document.getElementById('save-edit');
105
106 // Fetch todos from API
107 async function fetchTodos() {
108 try {
111 emptyState.classList.add('hidden');
112
113 const response = await fetch('/api/todos');
114 todos = await response.json();
115
183
184 try {
185 const response = await fetch('/api/todos', {
186 method: 'POST',
187 headers: {
213
214 try {
215 const response = await fetch(`/api/todos/${id}`, {
216 method: 'PUT',
217 headers: {
255
256 try {
257 const response = await fetch(`/api/todos/${currentEditId}`, {
258 method: 'PUT',
259 headers: {
289
290 try {
291 const response = await fetch(`/api/todos/${id}`, {
292 method: 'DELETE'
293 });

MobileTestingREADME.md1 match

@nbbaier•Updated 5 days ago
12## Project Structure
13
14- `index.ts` - Main HTTP entry point (backend API)
15- `frontend/index.html` - Main HTML template
16- `frontend/app.js` - Frontend JavaScript

zayREADME.md6 matches

@zaaynaah•Updated 5 days ago
5## Structure
6
7- `index.ts` - Main entry point with Hono API routes
8- `database/` - Database setup and queries
9 - `migrations.ts` - Database schema definitions
10 - `queries.ts` - Database query functions
11
12## API Endpoints
13
14### Jobs
15
16- `GET /api/jobs` - Get all job listings
17- `POST /api/jobs` - Create a new job listing
18
19### Messages
20
21- `GET /api/messages` - Get recent chat messages
22- `POST /api/messages` - Create a new chat message
23
24## Database

zayindex.ts5 matches

@zaaynaah•Updated 5 days ago
24await initDatabase();
25
26// API Routes
27app.get("/api/jobs", async (c) => {
28 const jobs = await getAllJobs();
29 return c.json(jobs);
30});
31
32app.post("/api/jobs", async (c) => {
33 const body = await c.req.json();
34
48});
49
50app.get("/api/messages", async (c) => {
51 const messages = await getRecentMessages();
52 return c.json(messages);
53});
54
55app.post("/api/messages", async (c) => {
56 const body = await c.req.json();
57

zayindex.js5 matches

@zaaynaah•Updated 5 days ago
75});
76
77// Load jobs from API
78async function loadJobs() {
79 try {
80 const response = await fetch("/api/jobs");
81 if (!response.ok) throw new Error("Failed to load jobs");
82
121
122 try {
123 const response = await fetch("/api/jobs", {
124 method: "POST",
125 headers: { "Content-Type": "application/json" },
144async function loadMessages() {
145 try {
146 const response = await fetch("/api/messages");
147 if (!response.ok) throw new Error("Failed to load messages");
148
190
191 try {
192 const response = await fetch("/api/messages", {
193 method: "POST",
194 headers: { "Content-Type": "application/json" },

create-val-api-demo1 file match

@shouser•Updated 3 hours ago

new-val-api-demo

@shouser•Updated 4 hours ago
This is an example of using the API to create a val.
artivilla
founder @outapint.io vibe coding on val.town. dm me to build custom vals: https://artivilla.com
mux
Your friendly, neighborhood video API.