Images
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: v19View latest version
A minimal image hosting service that displays the last 4 uploaded images.
- / - View the last 4 uploaded images (newest first)
- /add - Upload form for new images (no navigation links to this page)
- Automatic cleanup: images are deleted when there are 4 newer images
- Mobile and desktop friendly
- No frontend JavaScript required
- File size limit: 10MB per image
- Supports common image formats (JPEG, PNG, GIF, WebP)
- Built with Hono framework
- Uses SQLite for metadata storage (filename, content type, file size, upload date)
- Uses Val Town Blob storage for image files (stored as base64)
- Images are automatically cleaned up when more than 4 are uploaded
- Responsive design with CSS Grid and Flexbox
- Server-side rendering with no client-side JavaScript
- Upload functionality available but not linked from the UI
backend/index.ts- Main application entry point (HTTP trigger)backend/database/migrations.ts- Database schema initializationbackend/database/queries.ts- Database operations and image managementfrontend/style.css- Responsive CSS styling
- Visit the root URL to see uploaded images
- The
/addendpoint provides upload functionality but is not linked from the main interface - Images can be uploaded by directly accessing
/add - Only the 4 most recent images are kept; older images are automatically deleted
GET /- Home page with image gallery (no upload links)GET /add- Upload form page (no navigation links)POST /add- Handle image upload (multipart/form-data)GET /image/:blobKey- Serve individual imagesGET /frontend/style.css- CSS stylesheet