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=2&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 18778 results for "api"(3811ms)

slackBotExampleREADME.md1 match

@charmaine•Updated 10 hours ago
4
5This guide walks you through creating a Slack bot that replies when mentioned in
6a channel. You'll use Val Town to host your bot and Slack's API to connect it to
7your workspace.
8

slackBotExamplemain.tsx1 match

@charmaine•Updated 10 hours ago
34 try {
35 // Use standard fetch instead of fetchJSON for more control
36 const result = await fetch("https://slack.com/api/chat.postMessage", {
37 method: "POST",
38 headers: {

GlancergetActions.ts1 match

@lightweight•Updated 10 hours ago
3// Initialize Notion client
4const notion = new Client({
5 auth: Deno.env.get("NOTION_API_KEY"),
6});
7

GlancersetAction.ts1 match

@lightweight•Updated 10 hours ago
3// Initialize Notion client
4const notion = new Client({
5 auth: Deno.env.get("NOTION_API_KEY"),
6});
7

GlancerdemoCobrowseStatus.ts1 match

@lightweight•Updated 10 hours ago
5// Initialize Notion client
6const notion = new Client({
7 auth: Deno.env.get("NOTION_API_KEY"),
8});
9

Snotel-Analyzerindex.ts17 matches

@bjtitus•Updated 11 hours ago
1import { Hono } from "https://esm.sh/hono@3.11.7";
2import { readFile, serveFile } from "https://esm.town/v/std/utils@85-main/index.ts";
3import type { SnotelSite, SnotelData, ApiResponse } from "../shared/types.ts";
4
5const app = new Hono();
20});
21
22// API endpoint to get SNOTEL sites
23app.get("/api/sites", async c => {
24 try {
25 // Use specific Colorado SNOTEL station IDs
31
32 const response = await fetch(
33 `https://wcc.sc.egov.usda.gov/awdbRestApi/services/v1/stations?stationIds=${coStationIds.join(',')}`
34 );
35
36 if (!response.ok) {
37 throw new Error(`API request failed: ${response.status}`);
38 }
39
52 }));
53
54 const apiResponse: ApiResponse<SnotelSite[]> = {
55 success: true,
56 data: sites
57 };
58
59 return c.json(apiResponse);
60 } catch (error) {
61 console.error("Error fetching sites:", error);
62 const apiResponse: ApiResponse<SnotelSite[]> = {
63 success: false,
64 error: error instanceof Error ? error.message : "Unknown error"
65 };
66 return c.json(apiResponse, 500);
67 }
68});
69
70// API endpoint to get latest data for stations
71app.get("/api/data", async c => {
72 try {
73 // Get current date and 30 days ago for recent data
87 // Fetch recent data for these stations
88 const dataResponse = await fetch(
89 `https://wcc.sc.egov.usda.gov/awdbRestApi/services/v1/data?stationIds=${coStationIds.join(',')}&elementCds=SNWD,WTEQ,TOBS&ordinal=1&duration=DAILY&getFlags=false&alwaysReturnDailyFeb29=false&format=json&beginDate=${formatDate(startDate)}&endDate=${formatDate(endDate)}`
90 );
91
92 if (!dataResponse.ok) {
93 throw new Error(`Data API request failed: ${dataResponse.status}`);
94 }
95
136 });
137
138 const apiResponse: ApiResponse<SnotelData[]> = {
139 success: true,
140 data: Object.values(stationData)
141 };
142
143 return c.json(apiResponse);
144 } catch (error) {
145 console.error("Error fetching data:", error);
146 const apiResponse: ApiResponse<SnotelData[]> = {
147 success: false,
148 error: error instanceof Error ? error.message : "Unknown error"
149 };
150 return c.json(apiResponse, 500);
151 }
152});

Snotel-Analyzerindex.html2 matches

@bjtitus•Updated 11 hours ago
44 // Fetch sites and data in parallel
45 const [sitesResponse, dataResponse] = await Promise.all([
46 fetch('/api/sites'),
47 fetch('/api/data')
48 ]);
49

Snotel-Analyzertypes.ts1 match

@bjtitus•Updated 11 hours ago
24}
25
26export interface ApiResponse<T> {
27 success: boolean;
28 data?: T;

Snotel-AnalyzerREADME.md6 matches

@bjtitus•Updated 11 hours ago
1# SNOTEL Data Viewer
2
3A web application that displays the latest SNOTEL (Snow Telemetry) data from USDA's AWDB REST API.
4
5## Features
7- Displays latest snow and weather data from SNOTEL sites
8- Interactive table with site information
9- Real-time data fetching from USDA AWDB API
10
11## Project Structure
12
13- `backend/index.ts` - Main Hono server with API endpoints
14- `frontend/index.html` - Main HTML template
15- `frontend/index.tsx` - React frontend application
16- `shared/types.ts` - Shared TypeScript types
17
18## API Endpoints
19
20- `GET /` - Serves the main application
21- `GET /api/sites` - Fetches SNOTEL site data
22- `GET /api/data/:stationId` - Fetches latest data for a specific station
23
24## Usage

Glancerapi.ts0 matches

@lightweight•Updated 13 hours ago
1import { Hono } from "npm:hono";
2
3// Import route modules
4import cobrowse from "./getCobrowseStatus.ts";
5import database from "./getDatabase.ts";

helloEffectHttpApi1 file match

@mattrossman•Updated 7 hours ago

html-to-pdf-api2 file matches

@prashamtrivedi•Updated 19 hours ago
HTML to PDF converter API with blob storage
apiry
snartapi