Readonly
authAuthentication information:
Access: read only and the public podium interface. The request.events supports the following events:
Readonly
headersThe raw request headers (references request.raw.req.headers). See docs
Readonly
infoRequest information:
Readonly
logsAn array containing the logged request events. Note that this array will be empty if route log.collect is set to false.
Readonly
methodThe request method in lower case (e.g. 'get', 'post').
Readonly
mimeThe parsed content-type header. Only available when payload parsing enabled and no payload error occurred.
Readonly
origAn object containing the values of params, query, and payload before any validation modifications made. Only set when input validation is performed.
Readonly
paramsAn object where each key is a path parameter name with matching value as described in Path parameters.
Readonly
paramsAn array containing all the path params values in the order they appeared in the path.
Readonly
pathThe request URI's pathname component.
Readonly
payloadThe request payload based on the route payload.output and payload.parse settings. TODO check this typing and add references / links.
Plugin-specific state. Provides a place to store and pass request-level plugin data. The plugins is an object where each key is a plugin name and the value is the state.
Readonly
preAn object where each key is the name assigned by a route pre-handler methods function. The values are the raw values provided to the continuation function as argument. For the wrapped response object, use responses.
Readonly
preSame as pre but represented as the response object created by the pre method.
Readonly
queryBy default the object outputted from node's URL parse() method.
Readonly
rawAn object containing the Node HTTP server objects. Direct interaction with these raw objects is not recommended.
Access: read / write (see limitations below).
The response object when set. The object can be modified but must not be assigned another object. To replace the response with another from within an extension point, use reply(response) to
override with a different response.
In case of an aborted request the status code will be set to disconnectStatusCode
.
Readonly
routeAccess: read only and the public server interface. The server object.
Optional
sessionReadonly
stateAn object containing parsed HTTP state information (cookies) where each key is the cookie name and value is the matching cookie content after processing using any registered cookie definition.
Readonly
urlThe parsed request URI.
Returns true
when the request is active and processing should continue and false
when the
request terminated early or completed its lifecycle. Useful when request processing is a
resource-intensive operation and should be terminated early if the request is no longer active
(e.g. client disconnected or aborted early).
Subscribe a handler to an event. Same as podium.on().
A reference to the current emitter.
Subscribe a handler to an event. Same as podium.on().
A reference to the current emitter.
Emits an event update to all the subscribed listeners.
The event update criteria.
Optional
data: anyThe value emitted to the subscribers.
Promise that resolves when all events has been processed. Any errors will cause an immediate rejection.
Returns a response which you can pass into the reply interface where:
the value to set as the source of the reply interface, optional.
Optional
options: {options for the method, optional.
ResponseObject See docs
Returns whether an event has any listeners subscribed.
the event name string.
true if the event name has any listeners, otherwise false.
Logs request-specific events. When called, the server emits a 'request' event which can be used by other listeners or plugins. The arguments are:
a string or an array of strings (e.g. ['error', 'database', 'read']) used to identify the event. Tags are used instead of log levels and provide a much more expressive mechanism for describing and filtering events.
Optional
data: string | object | (() => string | object)(optional) an message string or object with the application data being logged. If data is a function, the function signature is function() and it called once to generate (return value) the actual data emitted to the listeners. Any logs generated by the server internally will be emitted only on the 'request-internal' channel and will include the event.internal flag set to true.
void See docs
Subscribe a handler to an event.
A reference to the current emitter.
Subscribe a handler to an event.
A reference to the current emitter.
Same as podium.on() with the count option set to 1.
Can also be called without an listener to wait for a single event.
The subscription criteria.
The handler method set to receive event updates. The function signature depends on the block, spread, and tags options.
Optional
context: TcontextOptional object that binds to the listener handler.
A reference to the current emitter.
Same as podium.on() with the count option set to 1.
Can also be called without an listener to wait for a single event.
The subscription criteria.
The handler method set to receive event updates. The function signature depends on the block, spread, and tags options.
Optional
context: TcontextOptional object that binds to the listener handler.
A reference to the current emitter.
Wait for a single event. The count option is fixed to 1.
The subscription criteria.
Promise with array of emitted parameters.
Same as podium.on() with the count option set to 1.
Can also be called without an listener to wait for a single event.
The subscription criteria.
A reference to the current emitter.
Register the specified events and their optional configuration. Events must be registered before they can be emitted or subscribed to. This is done to detect event name mispelling and invalid event activities.
The event(s) to register.
Registers another emitter as an event source for the current emitter (any event update emitted by the source emitter is passed to any subscriber of the current emitter).
Note that any events registered with a source emitter are automatically added to the current emitter. If the events are already registered, they are left as-is.
A Podium object or an array of objects, each added as a source.
Removes all listeners subscribed to a given event name.
The event name string.
A reference to the current emitter.
Removes all listeners subscribed to a given event name matching the provided listener method.
The event name string.
The function reference provided when subscribed.
A reference to the current emitter.
Changes the request method before the router begins processing the request where:
is the request HTTP method (e.g. 'GET').
void Can only be called from an 'onRequest' extension method. See docs
Changes the request URI before the router begins processing the request where: Can only be called from an 'onRequest' extension method.
the new request URI. If url is a string, it is parsed with node's URL parse() method with parseQueryString set to true. url can also be set to an object compatible with node's URL parse() method output.
Optional
stripTrailingSlash: booleanif true, strip the trailing slash from the path. Defaults to false.
void See docs
Application-specific state. Provides a safe place to store application data without potential conflicts with the framework. Should not be used by plugins which should use plugins[name]. See docs