serveTriggers
Purpose and behavior
Section titled “Purpose and behavior”Start an HTTP server that verifies each POST with its route source and publishes the job selected by on() as trigger:<path>:<delivery>; redeliveries publish nothing new. It answers 202, 204, 400, 401, 404, 405, 413, 500 or 503, a source can replace 202 and 204, and it resolves once listening; invalid options or an unavailable port reject. The caller closes the server, then its queue.
Complete example and detailed rules.
Parameters and properties
Section titled “Parameters and properties”optionsRequiredTriggerServerOptionsQueue, routes, listening address, body limit and failure observer.options.queueRequiredTaskQueueQueue receiving the jobs; a rejected enqueue answers 503.options.routesRequiredreadonly TriggerRoute[]At least one route with a unique path.options.hostOptionalstring | undefinedListening address; defaults to 127.0.0.1. Expose the server through a TLS-terminating proxy.options.portOptionalnumber | undefinedListening port; 0 or omitted selects a free port reported in url.options.maxBytesOptionalnumber | undefinedRequest body limit in bytes; defaults to 1 MiB, at most 25 MiB. Larger bodies answer 413.options.onErrorOptional((error: unknown, failure: TriggerFailure) => void) | undefinedObserves verification, routing and publication failures with the path and, after verification, the delivery; never receives secrets. Errors thrown by the callback are ignored.