The REserve server object implements an interface that mimics the EventEmitter::on method and triggers events with parameters to 'notify' any listener of its activity.
When a request is processed, the following diagram illustrates the sequence of events that are emitted.

Diagram of events emitted by REserve while processing a request
[!NOTE] These events are handled by the
loghelper.
EventeventName |
Parameters...members |
Description |
|---|---|---|
'created' |
server: http.server | https.serverconfiguration: IConfiguration |
Only available to listeners, this event is emitted after the HTTP(S) server is 'created' and before it accepts requests. |
'ready' |
url: stringport: numberhttp2: boolean |
The server is listening and ready to receive requests.url contains a valid address (for instance: 'http://192.168.4.1:8080/'). |
'incoming' |
method: string (uppercase)incomingUrl: Stringurl: stringheaders: { [key: string]: string \| string[] }start: Dateid: numberinternal: boolean |
New request received.incomingUrl contains the original URL (before normalization).url contains the URL to be matched.id is a unique identifier allocated by REserve.internal signals internally dispatched request (see configuration interface).These members are also available for 'error', 'redirecting','redirected', 'aborted' and 'closed' events. |
'error' |
reason: any |
An error occurred. |
'error' |
...'incoming'reason: any |
An error occurred while processing a request. |
'redirecting' |
...'incoming'type: stringredirect: string | number |
Request will be processed by a handler.type contains the handler prefix.redirect contains the redirection value. |
'redirected' |
...'incoming'end: DatetimeSpent: number (ms)statusCode: number |
Request is fully processed.timeSpent is evaluated by comparing start and end (not a high resolution timer). |
'aborted' |
...'incoming' |
Request was aborted. |
'closed' |
...'incoming' |
Request was closed. |