Public
Like
4
Electric
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: v61View latest version
static-site is a lightweight static site hosting solution built on Val Town that enables easy publishing and management of static websites and documentation. With a simple API and convenient CLI tools, you can deploy your static content with minimal setup.
- Simple File Management: Upload, download, list, and delete files through a RESTful API
- Command Line Interface: Easy-to-use CLI for bulk operations with concurrent uploads
- Authentication: Secure API access with bearer token authentication
- Caching: Optimized content delivery with configurable cache settings
- Val Town Integration: Leverages Val Town's blob storage for reliable file hosting
- Remix this Val by clicking the remix button
- Go to environmental variables, and set
MASTER_BEARERto some secure code. You can useopenssl rand -base64 32to generate a cryptographically random one. Make sure to save it. - [OPTIONAL] Set a vanity domain for the static site by going to
backend/app.tsand choosing a new domain. - Set the
ROOT_URLenvironmental variable to that root url.
Now, make sure you have Deno installed locally, and then
# Install the CLI tool deno install -grAf -n=electric https://esm.town/v/wolf/StaticSite/cli/mod.ts # Upload a directory of static files electric upload ./my-site # List your uploaded files electric list
For all CLI commands, run electric --help.
The service exposes RESTful endpoints for programmatic access:
GET /api/index: List all filesPOST /api/index: Upload a new fileGET /api/index/:path: Download a specific fileDELETE /api/index/:path: Delete a file