Sample Configuration
Configuration
number
The port to listen on. Defaults to
3111.string
The host to listen on. Defaults to
0.0.0.0.number
The default timeout in milliseconds for request processing. Defaults to
30000.number
The maximum number of concurrent requests the server will handle. Defaults to
1024.Cors
The CORS configuration.
number
Maximum request body size in bytes. Defaults to
1048576 (1 MB).boolean
When
true, the engine trusts proxy headers such as X-Forwarded-For for client IP resolution. Defaults to false.string
Header name used to propagate or generate a request ID. Defaults to
x-request-id.boolean
When
true, routes with and without a trailing slash are treated as equivalent. Defaults to false.string
Function ID to invoke when no route matches a request. When unset, the engine returns a default 404 response.
Trigger Type
This worker adds a new Trigger Type:http.
Sample code
Request & Response Objects
ApiRequest
When an API trigger fires, the function receives anApiRequest object:
string
The request path.
string
The HTTP method of the request (e.g.,
GET, POST).Record<string, string>
Variables extracted from the URL path (e.g.,
/users/:id).Record<string, string>
URL query string parameters.
any
The parsed request body (JSON).
Record<string, string>
HTTP request headers.
object
Metadata about the trigger that fired the function.
object
Request context object. Populated by middleware and available to handler functions.
ApiResponse
Functions must return anApiResponse object:
number
HTTP status code (e.g., 200, 404, 500).
any
The response payload.
string[]
HTTP response headers as
"Header-Name: value" strings (e.g., ["Content-Type: application/json"]). Optional.Middleware
The HTTP worker supports middleware functions that run before the handler. There are two types:- Per-route middleware — attached to a specific trigger via
middleware_function_idsin trigger config - Global middleware — configured in
iii-config.yaml, runs on all HTTP routes
Global Middleware Configuration
MiddlewareConfig[]
List of global middleware functions. Each runs on every HTTP request, before conditions and per-route middleware.
Middleware Function Contract
Middleware functions receive a lightweight request object (no body):string
The phase in which the middleware is executing (
preHandler).object
Request metadata:
path_params, query_params, headers, method. Does not include body.object
Empty context object for future use.
{ action: "continue" }— proceed to the next middleware or handler.{ action: "respond", response: { status_code, body, headers } }— short-circuit and return a response immediately. Remaining middleware and the handler are skipped.