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=365&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 4595 results for "api"(466ms)

askSMHI

askSMHIfetcher1 match

@ljus•Updated 1 month ago
11 }
12 const response = await fetch(
13 `https://opendata-download-metfcst.smhi.se/api/category/pmp3g/version/2/geotype/point/lon/${lon}/lat/${lat}/data.json`,
14 );
15
askSMHI

askSMHImoderation1 match

@ljus•Updated 1 month ago
9 Authorization: `Bearer ${openAIKey}`,
10 };
11 const openai = new OpenAI({ apiKey: process.env.OPENAI_CHAT });
12 const responseData = await openai.moderations.create({ input: publicMessages });
13 return { flagged: responseData.results.some((r) => r.flagged) };

newCerebrasModelAlertmain.tsx2 matches

@stevekrouse•Updated 1 month ago
7 const historicalModels = await blob.getJSON("cerebras-models.json");
8
9 const currentModels = await fetchJSON("https://api.cerebras.ai/v1/models", {
10 bearer: Deno.env.get("CEREBRAS_API_KEY"),
11 });
12 await blob.setJSON("cerebras-models.json", currentModels);

OpenTowniesoundEffects.ts4 matches

@stevekrouse•Updated 1 month ago
4
5/**
6 * Plays a bell sound notification using the Web Audio API
7 * @returns A Promise that resolves when the sound has started playing
8 */
13 const AudioContext = window.AudioContext || (window as any).webkitAudioContext;
14 if (!AudioContext) {
15 console.warn("Web Audio API not supported in this browser");
16 resolve();
17 return;
65
66/**
67 * Plays a simple notification sound using the Web Audio API
68 * This is a simpler, shorter bell sound
69 * @returns A Promise that resolves when the sound has started playing
75 const AudioContext = window.AudioContext || (window as any).webkitAudioContext;
76 if (!AudioContext) {
77 console.warn("Web Audio API not supported in this browser");
78 resolve();
79 return;

instagramScrapingREADME.md1 match

@wolf•Updated 1 month ago
6
7- `/` - Main application page
8- `/extract?url={instagram_url}` - API endpoint to extract post data
9- `/extract?url={instagram_url}&proxyImage=true` - Endpoint to proxy Instagram images
10

bingImageOfDayindex.tsx1 match

@wolf•Updated 1 month ago
109 path: "/docs",
110 method: "GET",
111 description: "Provides API documentation.",
112 response: "JSON object with details about available endpoints.",
113 },

bingImageOfDayREADME.md4 matches

@wolf•Updated 1 month ago
1# Bing Image of the Day Archive
2
3This Val Town project fetches, displays, and archives the Bing Image of the Day, providing an API to access both current and historical images.
4
5## Overview
10- Retrieve specific historical images by date
11
12## API Endpoints
13
14| Endpoint | Method | Description |
18| `/get/:date` | GET | Returns a specific archived image by date (format: MM-DD-YYYY) |
19| `/backup` | GET | Manually triggers a backup of the current Bing Image of the Day |
20| `/docs` | GET | Returns API documentation in JSON format |
21
22### How It Works
24- The service scrapes the Bing image from a public source (bing.gifposter.com)
25- Images are stored in Val Town's blob storage with keys in the format `bing-images-of-day/MM-DD-YYYY.jpg`
26- The main API serves both current and archived images with proper caching headers
27- Automation can be set up to trigger the backup endpoint daily to build a complete archive
28

AlwaysHereBackendREADME.md5 matches

@ninadxc•Updated 1 month ago
8## Hono
9
10This app uses [Hono](https://hono.dev/) as the API framework. You can think of Hono as a replacement for [ExpressJS](https://expressjs.com/) that works in serverless environments like Val Town or Cloudflare Workers. If you come from Python or Ruby, Hono is also a lot like [Flask](https://github.com/pallets/flask) or [Sinatra](https://github.com/sinatra/sinatra), respectively.
11
12## Serving assets to the frontend
20### `index.html`
21
22The most complicated part of this backend API is serving index.html. In this app (like most apps) we serve it at the root, ie `GET /`.
23
24We *bootstrap* `index.html` with some initial data from the server, so that it gets dynamically injected JSON data without having to make another round-trip request to the server to get that data on the frontend. This is a common pattern for client-side rendered apps.
25
26## CRUD API Routes
27
28This app has two CRUD API routes: for reading and inserting into the messages table. They both speak JSON, which is standard. They import their functions from `/backend/database/queries.ts`. These routes are called from the React app to refresh and update data.
29
30## Errors
31
32Hono and other API frameworks have a habit of swallowing up Errors. We turn off this default behavior by re-throwing errors, because we think most of the time you'll want to see the full stack trace instead of merely "Internal Server Error". You can customize how you want errors to appear.

reactHonoExamplegoogleOAuth.ts2 matches

@varun1352•Updated 1 month ago
15
16 // Exchange code for tokens
17 const tokenResponse = await fetch("https://oauth2.googleapis.com/token", {
18 method: "POST",
19 headers: { "Content-Type": "application/x-www-form-urlencoded" },
30
31 // Fetch user info
32 const userInfoResponse = await fetch("https://www.googleapis.com/oauth2/v3/userinfo", {
33 headers: { Authorization: `Bearer ${access_token}` },
34 });

reactHonoExampleindex.ts2 matches

@varun1352•Updated 1 month ago
3import { Hono } from "npm:hono";
4
5// Import your API routes
6import { googleOAuth } from "./auth/googleOAuth.ts";
7// Later: import userApi from "./api/user.ts"; etc.
8
9const app = new Hono();

PassphraseAPI2 file matches

@wolf•Updated 2 days ago

openapi2 file matches

@stevekrouse•Updated 4 days ago
artivilla
founder @outapint.io vibe coding on val.town. dm me to build custom vals: https://artivilla.com
fiberplane
Purveyors of Hono tooling, API Playground enthusiasts, and creators of 🪿 HONC 🪿 (https://honc.dev)