• Townie
    AI
  • Blog
  • Docs
  • Pricing
  • We’re hiring!
Log inSign up
flymaster

flymaster

life

Public
Like
life
Home
Code
5
backend
2
.vtignore
AGENTS.md
README.md
deno.json
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
/
Code
/
Search
index.http.tsx
https://flymaster--9bab2626adb311f0a9740224a6c84d84.web.val.run
README.md

REST API Service

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.

Project Structure

backend/
├── database/
│   ├── migrations.ts    # Database schema setup
│   └── queries.ts       # Database query functions
└── index.http.tsx       # Main HTTP handler with Hono routes

Database Schema

The database has one table with four columns:

  • last_edited_date (TEXT) - Automatically set to current ISO timestamp
  • title (TEXT) - The entry title
  • content (TEXT) - The entry content
  • tags (TEXT) - The entry tags

API Endpoints

POST /{title}

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" } }

GET /{title}

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" }

DELETE /{title}

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": "" } }

Example Usage

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

Notes

  • 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
HTTP
  • index.http.tsx
    flymaster--9bab2626adb311f0a9740224a6c84d84.web.val.run
Code
backend.vtignoreAGENTS.mdREADME.mddeno.json
FeaturesVersion controlCode intelligenceCLI
Use cases
TeamsAI agentsSlackGTM
DocsShowcaseTemplatesNewestTrendingAPI examplesNPM packages
PricingNewsletterBlogAboutCareers
We’re hiring!
Brandhi@val.townStatus
X (Twitter)
Discord community
GitHub discussions
YouTube channel
Bluesky
Terms of usePrivacy policyAbuse contact
© 2025 Val Town, Inc.