Public
Lost-item alert inbox: finders POST, watchers poll with secret
apihttpsqlite
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.

lostFoundInbox

A tiny alert inbox for a "Found It" lost-item page: finders report an item, a watcher polls for new reports.

Live endpoint: main.ts — https://lost-found-inbox.val.run/

API

RequestResponse
POST / { reason, note?, phone? }{ ok: true } · { ok:false, error } on 400/429
GET /?secret=… (or Authorization: Bearer …){ ok: true, alerts: [...] } — marks them delivered
GET / (no secret){ ok: true, service } — health check, no data
OPTIONS204 with CORS headers

Finder errors: bad_json, missing_reason, rate_limited (max 1 alert per IP per 60s), method_not_allowed.

Storage

Project-scoped SQLite:

  • alerts — id, reason, note, phone, created_at, delivered
  • ratelimit — ip, ts (rolling 1-hour window)

Setup

Set READ_SECRET on this val to the value your watcher sends. Until it is set, every GET ?secret=… returns 401 unauthorized — it fails closed.