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=129&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 13875 results for "api"(909ms)

untitled-860checkCert.tsx2 matches

@jclack2•Updated 5 days ago
19 clearTimeout(timeoutId);
20
21 // Unfortunately, the fetch API doesn't give us direct access to the certificate
22 // So we need to use the tls module in Node.js or Deno's TLS APIs
23
24 // For Val Town, we can use Deno's TLS connect function

NPLLMmod.ts2 matches

@wolf•Updated 5 days ago
4import { npmPackageRoute } from "./routes/npm-package.ts";
5
6export const apiRoute = new Hono()
7 .route("/search", searchRoute)
8 .route("/package", packageRoute)
9 .route("/npm-package", npmPackageRoute);
10
11export type AppType = typeof apiRoute;
12
5 const host = "www.cdatacloud.net";
6
7 const analyzeRes = await fetch(`https://api.ssllabs.com/api/v3/analyze?host=${host}`);
8 const analyzeJson = await analyzeRes.json();
9
18
19 const endpointRes = await fetch(
20 `https://api.ssllabs.com/api/v3/getEndpointData?host=${host}&ip=${endpoint.ipAddress}`,
21 );
22 const endpointJson = await endpointRes.json();

sa_pro1README.md2 matches

@pro3•Updated 5 days ago
24
25- Built on Val Town using TypeScript
26- Uses OpenAI's API for prompt expansion
27- Responsive design with Twind (Tailwind CSS in JS)
28- Error handling for API failures
29
30## Technical Stack

sa_pro1prompt-expander.ts1 match

@pro3•Updated 5 days ago
200 const url = new URL(req.url);
201
202 // Handle the expand API endpoint
203 if (url.pathname === "/expand") {
204 if (req.method !== "POST") {

NPLLMhono.ts3 matches

@wolf•Updated 5 days ago
3import { hc } from "https://esm.sh/hono@4.7.7/client?deps=hono@4.7.7";
4import { QueryClient } from "https://esm.sh/@tanstack/react-query@5.74.7?deps=react@19.0.0";
5import { AppType } from "../backend/api/mod.ts";
6import { APP_URL } from "../shared/consts.ts";
7
8export const client = hc<AppType>(
9 typeof window !== "undefined"
10 ? window.location.origin + "/api"
11 : APP_URL + "/api",
12 { init: { credentials: "include" } },
13);

sa_proREADME.md2 matches

@pro3•Updated 5 days ago
7- Expands even single-word prompts into rich, detailed content
8- Simple, clean user interface with example suggestions
9- Real-time prompt expansion using OpenAI's API
10- Responsive design that works on mobile and desktop
11- Error handling and loading states
46## Notes
47
48This application uses the OpenAI API which requires an API key. Make sure your Val Town account has an OpenAI API key configured in the environment variables.

sa_proprompt-expander.ts3 matches

@pro3•Updated 5 days ago
2
3export default async function (req: Request): Promise<Response> {
4 // Handle API requests for prompt expansion
5 if (req.url.includes("/api/expand") && req.method === "POST") {
6 try {
7 const { prompt } = await req.json();
199
200 try {
201 const response = await fetch('/api/expand', {
202 method: 'POST',
203 headers: {

sa_pro3README.md4 matches

@pro3•Updated 5 days ago
37
38- Built as an HTTP-triggered Val in Val Town
39- Uses OpenAI's API to generate prompts
40- Frontend styled with TailwindCSS
41- Handles both GET and POST requests in a single endpoint
42- Includes error handling for API failures
43
44## Setup
46To use this application, you need to:
47
481. Set up an OpenAI API key as an environment variable in Val Town
492. Deploy the Val with HTTP trigger enabled
50
51## Environment Variables
52
53- `OPENAI_API_KEY`: Your OpenAI API key for generating prompts
54
55## Customization

untitled-8834index.ts5 matches

@hend_elsaeidy•Updated 5 days ago
7
8export default async function(req: Request): Promise<Response> {
9 // Handle API requests for promo code generation
10 if (req.url.includes('/api/generate-promo')) {
11 return handlePromoGeneration(req);
12 }
21
22/**
23 * Handles the API request to generate a promo code
24 */
25async function handlePromoGeneration(req: Request): Promise<Response> {
214 generateBtn.textContent = 'Generating...';
215
216 // Call the API to generate promo code
217 const response = await fetch('/api/generate-promo', {
218 method: 'POST',
219 headers: {

new-val-api-demo

@shouser•Updated 12 hours ago
This is an example of using the API to create a val.

groq-api2 file matches

@cameronpak•Updated 16 hours ago
mux
Your friendly, neighborhood video API.
api