FeaturesTemplatesShowcaseTownie
AI
BlogDocsPricing
Log inSign up
craigz
craigzpale-apex-preamble
a simple express app
Public
Like
pale-apex-preamble
Home
Code
8
.gitignore
.vtignore
README.md
deno.json
dev.sh
H
index.http.tsx
local-dev.ts
local-form.html
Branches
1
Pull requests
Remixes
History
Environment variables
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.
Sign up now
Code
/
README.md
Code
/
README.md
Search
6/27/2025
Viewing readonly version of main branch: v27
View latest version
README.md

pale-apex-preamble

A replacement for a simple express app that accepts a URL on its / endpoint and returns the page's source code to the requesting browser.

  • Added as a test and to replace a similar application formerly hosted at glitch.
  • Moved main app away from express and implemented an HTTP Type val.

Development

Quick Start

# Start local development server ./dev.sh local # or deno task local-dev # Deploy to Val Town ./dev.sh push # or deno task push

Available Commands

  • ./dev.sh dev - Start Val Town development server
  • ./dev.sh local - Start local development server (port 3001)
  • ./dev.sh push - Format, check, and deploy to Val Town
  • ./dev.sh status - Check project status
  • ./dev.sh logs - View logs
  • ./dev.sh help - Show all commands

Testing

Test locally: http://localhost:3001?url=https://example.com

App Status

  • The / endpoint with no parameters shows a simple HTML form for entering a URL
  • When provided with a url query parameter, it returns the source code of that page as plain text
  • Includes URL validation and error handling
  • Migrated from Express.js to Val Town HTTP handler format

Implementation Notes

The original Express app was a simple form that accepted a URL and returned the source code. The new implementation:

  1. Provides a more user-friendly HTML form when no URL is provided
  2. Validates the URL format before attempting to fetch
  3. Returns the source as plain text for easy viewing
  4. Handles errors gracefully with appropriate status codes

API Usage

GET /?url=https://example.com

Returns: The source code of the specified URL as plain text

Go to top
X (Twitter)
Discord community
GitHub discussions
YouTube channel
Bluesky
Product
FeaturesPricing
Developers
DocsStatusAPI ExamplesNPM Package Examples
Explore
ShowcaseTemplatesNewest ValsTrending ValsNewsletter
Company
AboutBlogCareersBrandhi@val.town
Terms of usePrivacy policyAbuse contact
ยฉ 2025 Val Town, Inc.