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=184&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 15080 results for "api"(1316ms)

twitterCompetitorMonitoringapi.ts3 matches

@jamiedubs•Updated 1 week ago
7 const url = new URL(req.url);
8
9 // API endpoint to get tweet data as JSON
10 if (url.pathname === "/api/data") {
11 const dailyCounts = await getTweetCountsByDay();
12 const totalCounts = await getTotalTweetCounts();
92 async function renderCharts() {
93 try {
94 const response = await fetch('/api/data');
95 const data = await response.json();
96 console.log({ data });

twitterCompetitorMonitoringREADME.md2 matches

@jamiedubs•Updated 1 week ago
92. **Database** (`db.ts`): Uses SQLite to store tweet data and provides functions to query the data.
10
113. **Web Interface** (`api.ts`): Serves an HTML page with charts showing tweet counts per competitor per day.
12
13## Competitors Tracked
25## How to Use
26
271. Set up the `TWITTER_BEARER_TOKEN` environment variable with your Twitter API bearer token.
28
292. The cron job will automatically run every hour to collect data.

RoshanMustaqbilindex.ts12 matches

@debuggerist•Updated 1 week ago
3import { cors } from "https://esm.sh/hono@3.11.7/middleware";
4import { readFile, serveFile } from "https://esm.town/v/std/utils@85-main/index.ts";
5import { getDashboardData, getQuizSubmissions } from "./api";
6import { ApiResponse, DashboardData, QuizSubmission } from "./types";
7
8const app = new Hono();
16app.use("*", cors());
17
18// API Routes
19app.get("/api/dashboard", async (c) => {
20 try {
21 // Get auth token from header
24
25 if (!token) {
26 return c.json<ApiResponse<null>>({
27 success: false,
28 error: "Authentication required"
33
34 if (!dashboardData) {
35 return c.json<ApiResponse<null>>({
36 success: false,
37 error: "Invalid authentication or teacher not found"
39 }
40
41 return c.json<ApiResponse<DashboardData>>({
42 success: true,
43 data: dashboardData
45 } catch (error) {
46 console.error("Dashboard error:", error);
47 return c.json<ApiResponse<null>>({
48 success: false,
49 error: "Server error fetching dashboard data"
52});
53
54app.get("/api/quiz/:quizId/submissions", async (c) => {
55 try {
56 const quizId = c.req.param("quizId");
59
60 if (!token) {
61 return c.json<ApiResponse<null>>({
62 success: false,
63 error: "Authentication required"
67 const submissions = await getQuizSubmissions(quizId);
68
69 return c.json<ApiResponse<QuizSubmission[]>>({
70 success: true,
71 data: submissions
73 } catch (error) {
74 console.error("Submissions error:", error);
75 return c.json<ApiResponse<null>>({
76 success: false,
77 error: "Server error fetching submissions"
22 try {
23 const token = localStorage.getItem('teacherToken') || '';
24 const response = await fetch(`/api/quiz/${quiz.quiz_id}/submissions`, {
25 headers: {
26 'Authorization': `Bearer ${token}`

RoshanMustaqbilLoginForm.tsx1 match

@debuggerist•Updated 1 week ago
17
18 // For demo purposes, we're using a mock token
19 // In a real app, you would authenticate with your API
20 setTimeout(() => {
21 // Mock successful login for teacher@example.com/password

RoshanMustaqbilindex.tsx1 match

@debuggerist•Updated 1 week ago
28
29 try {
30 const response = await fetch('/api/dashboard', {
31 headers: {
32 'Authorization': `Bearer ${token}`

RoshanMustaqbilapi.ts6 matches

@debuggerist•Updated 1 week ago
1// Mock API functions for teacher dashboard
2// In real implementation, these would connect to your actual backend API
3
4import { User, Quiz, QuizSubmission, QuizWithStats, SubmissionStats, DashboardData } from './types';
5
6// Mock data - replace with actual API calls
7const MOCK_TEACHER: User = {
8 user_id: "t123",
162// Get teacher data with authentication token
163export async function getTeacherData(token: string): Promise<User | null> {
164 // In real implementation, validate token with your API
165 // For mock, just return the teacher
166 return MOCK_TEACHER;
169// Get all quizzes for a teacher with stats
170export async function getTeacherQuizzes(teacherId: string): Promise<QuizWithStats[]> {
171 // In real implementation, fetch from your API
172 const teacherQuizzes = MOCK_QUIZZES.filter(q => q.teacher_id === teacherId);
173
180// Get submissions for a specific quiz
181export async function getQuizSubmissions(quizId: string): Promise<QuizSubmission[]> {
182 // In real implementation, fetch from your API
183 return MOCK_SUBMISSIONS.filter(s => s.quiz_id === quizId);
184}

RoshanMustaqbiltypes.ts2 matches

@debuggerist•Updated 1 week ago
48}
49
50// API Response types
51export interface ApiResponse<T> {
52 success: boolean;
53 data?: T;

RoshanMustaqbilREADME.md2 matches

@debuggerist•Updated 1 week ago
9## Project Structure
10
11- `backend/` - Server-side code aur API endpoints
12 - `index.ts` - Main HTTP handler
13 - `types.ts` - TypeScript types
14 - `api.ts` - API functions
15- `frontend/` - Client-side code
16 - `index.html` - Main HTML template

May19README.md1 match

@MattPayneOrg•Updated 1 week ago
35 - React for UI components and state management
36 - TailwindCSS for styling
37 - LocalStorage API for data persistence
38
39## Usage

HN-fetch-call2 file matches

@ImGqb•Updated 7 hours ago
fetch HackerNews by API

token-server1 file match

@kwhinnery_openai•Updated 1 day ago
Mint tokens to use with the OpenAI Realtime API for WebRTC
Kapil01
apiv1