Reference

Request Pipeline

Every client request passes through the same five-stage pipeline before reaching your handler. Understanding the order clarifies why certain status codes are returned.

1
Version check | mismatch → silent reject + Tamper strike
2
TokenBucket 429 | empty bucket → 429 Too Many Requests
3
Middleware 403 500 | return false → 403 · unhandled error → 500
4
Route matching 404 400 | no match → 404 · coercion failure → 400
5
Handler dispatch 500 | unhandled error → 500 · no Send() → implicit 200

Expanded detail

Version check: The payload is validated against the expected RoExpress protocol version. A version mismatch is recorded as a Tamper strike and the request is rejected silently | no response is sent to the client.

TokenBucket: The player's token bucket is checked. If empty, the request is rejected immediately with 429. Tokens refill continuously at the configured refillRate per second.

Middleware: Each registered middleware runs in registration order. Return false to send 403 and stop processing. An unhandled error sends 500.

Route matching: The Router finds the best matching pattern. No match → 404 (also a Tamper signal). Typed param coercion failure → 400, or your custom app:OnParamError() handler.

Handler dispatch: Your handler is called. Unhandled errors send 500. If the handler exits without res:Send() or res:Error(), the response is finalized as a 200 with nil data.

Status codes reference

CodeStageCause
200Handlerres:Send(data) or implicit empty response
400Route matchingTyped param coercion failure
403MiddlewareMiddleware returned false
404Route matchingNo route matched the request path
429TokenBucketPlayer's token bucket is empty
500Middleware or HandlerUnhandled Lua error

Ports run the same pipeline

Each Port has its own independent pipeline instance | its own TokenBucket, its own middleware stack, its own Router. A 429 on the combat port does not affect the inventory port.

See also

App | middleware and routing  ·  TokenBucket | rate limiting  ·  Tamper | version check & exploit detection  ·  Router | route matching  ·  Reference Overview