ATAPI Twin
Pages

Concepts

Request matching

Method and path pick the candidates. Extra rules narrow them.

A route matches when the method matches, or the method is *, and the path pattern matches segment for segment. :id captures one segment. After that, every match rule must pass.

A rule is a JSON object with kind, name, op, and value. kind is header, query, body, or path. op is eq, contains, or regex. Header names are compared case-insensitively. body looks up a field on the parsed JSON body. path runs the regex against the request path. Up to 20 rules are kept.

[
  { "kind": "header", "name": "x-env", "op": "eq", "value": "prod" },
  { "kind": "body", "name": "sku", "op": "regex", "value": "^dev" }
]

When more than one route matches, the higher priority number wins. Routes that tie are chosen by weight. The same path can therefore serve a prod header one body and everyone else another.