Core
Framework v2.x
2

register() #

Available since 2.8.0
Experimental: non-backward compatible changes or removal may occur in any future release.

Registers a new pipe on an event.

This method can only be used before the application is started.

Copied to clipboard!
register(event: string, handler: EventHandler): void

Argument Type Description
event
string
Event name
handler
EventHandler
Function to execute when the event is triggered

Usage #

Copied to clipboard!
app.pipe.register('server:afterNow', async (request: KuzzleRequest) => {
  request.result.now = (new Date()).toUTCString()

  return request
})