Core
Framework v2.x
2

register() #

Available since 2.8.0

Registers a new hook 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('request:onError', async (request: KuzzleRequest) => {
  app.log.error(error)
})