Public
Like
cp-root
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in milliseconds.
Viewing readonly version of main branch: v272View latest version
A caching system to efficiently display all your Val Town HTTP endpoints in a beautiful web interface.
- Fetch all vals from Val Town API
- Loop through vals and extract file information
- Filter files to find HTTP endpoints (any file with endpoint URL)
- Caching system using Val Town Blob Storage
- Automated cache updates via cron job
- Beautiful web interface to browse endpoints
- Manual cache refresh capability
- Cache metadata tracking (last updated, performance metrics)
vals.tsx- ExportsfetchVals()function to get list of all valsval-files.tsx- ExportsfetchValFiles()function to get files for a specific valvals-all-files.tsx- Combines both functions to get all vals with their HTTP endpoints
cache-manager.ts- Blob storage interface for caching vals data with metadatacache-updater.ts- Cron job that automatically refreshes the cachesimple-index.tsx- Main web interface displaying cached endpoint data
test-cache.tsx- Manual cache population for testingtest-api.tsx- API testing endpoints
Visit the main endpoint to see all your HTTP endpoints in a beautiful interface:
- Shows total vals count, endpoint count, and last update time
- Lists all vals with their HTTP endpoints
- Direct links to each endpoint
- Responsive design with Tailwind CSS
The cache automatically updates via cron job, but you can also:
- Manual refresh: Use the test-cache endpoint to populate cache immediately
- Cache info: Check cache metadata and freshness status
- Live data: Bypass cache to get real-time data (slower)
/- Main web interface (cached data)test-cache.tsx- Manually refresh cachetest-api.tsx/cache-info- Get cache metadatatest-api.tsx/cached- Get cached data as JSON
- Cache hit: ~200-500ms response time
- Live data: ~2-5s response time (hits Val Town API)
- Cache update: Runs automatically via cron, ~500ms update time
- Storage: Uses Val Town Blob Storage (efficient key-value storage)
The cron job schedule can be configured in the Val Town web UI. The cache is considered "fresh" for 1 hour by default, but will display data regardless of age.
Cache keys:
vals_with_files_cache- Main datavals_with_files_cache_metadata- Update timestamps and metrics