Stone.jsDocs
Paradigm

Routing

Query & body

Path parameters, query strings and request bodies all arrive as one thing: values on the event. A single accessor reads them, so your handler never branches on where a value came from, only on what it means.

#One accessor for everything

event.get(key, default?) reads a value whatever its source. The typed overload event.get<T>(key, default) documents the shape you expect. Precedence and the raw containers are available when you need to be explicit.

app/Tasks.tsts
@Get('/')
list (event: IncomingHttpEvent) {
  const status = event.get<string>('status', 'all')   // ?status=done
  const limit  = Number(event.get<string>('limit', '20'))
  return this.tasks.list({ status, limit })
}

@Post('/')
create (event: IncomingHttpEvent) {
  const title = event.get<string>('title')            // from the body
  return this.tasks.add(title)
}

#Reading specific sources

AccessorTypeDescription
event.get(k, d?)(key, default?)Read a value from any source (params, query, body), with an optional default.
event.has(k)(key)Whether a key is present.
event.queryURLSearchParams-likeThe parsed query string.
event.bodyunknownThe parsed request body (JSON, form, ...).
event.paramsRecord<string, string>The captured path parameters.

Stone.js

Your app exists in every runtime. Until you run it.

An open-source project by Stone Foundation
Created by Mr. Stone (Evens Pierre)