life
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.
index.http.tsx
https://flymaster--9bab2626adb311f0a9740224a6c84d84.web.val.run
A simple append-only REST API service for Val Town with a SQLite database that stores entries with title, content, tags, and last edited date.
backend/
├── database/
│ ├── migrations.ts # Database schema setup
│ └── queries.ts # Database query functions
└── index.http.tsx # Main HTTP handler with Hono routes
The database has one table with four columns:
last_edited_date
(TEXT) - Automatically set to current ISO timestamptitle
(TEXT) - The entry titlecontent
(TEXT) - The entry contenttags
(TEXT) - The entry tags
Creates a new entry with the given title.
Request Body:
{ "content": "Your content here", "tags": "tag1,tag2" }
Response (201):
{ "message": "Entry created", "entry": { "last_edited_date": "2025-10-20T12:00:00.000Z", "title": "example", "content": "Your content here", "tags": "tag1,tag2" } }
Returns the most recently created entry with the given title.
Response (200):
{ "last_edited_date": "2025-10-20T12:00:00.000Z", "title": "example", "content": "Your content here", "tags": "tag1,tag2" }
Response (404):
{ "error": "Entry not found" }
Creates a blank entry with the given title (append-only deletion).
Response (200):
{ "message": "Blank entry created", "entry": { "last_edited_date": "2025-10-20T12:00:00.000Z", "title": "example", "content": "", "tags": "" } }
Create an entry:
curl -X POST https://[your-username]-[val-name].web.val.run/my-entry \ -H "Content-Type: application/json" \ -d '{"content": "Hello world", "tags": "test,demo"}'
Get the latest entry:
curl https://[your-username]-[val-name].web.val.run/my-entry
Delete an entry (creates blank entry):
curl -X DELETE https://[your-username]-[val-name].web.val.run/my-entry
- This is an append-only database - no true updates or deletes
- DELETE operations create a new blank entry with the current timestamp
- The most recent entry for a given title is always returned by GET
- All timestamps are in ISO 8601 format