Register the following hooks to the application:
- Source
- The list of hooks to be registered
- Type:
- Promise.<Array.<external:THook>>
Members
(static) waibu:onClose :external:THook
Hook object for the 'waibu:onClose' event. The handler is invoked when the server is closed and logs a message indicating that the server has been closed.
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
name | string | <optional> | 'waibu:onClose' | The name of the hook |
handler | onCloseHandler | The handler function for the hook |
- Source
(static) waibu:onReady :external:THook
Hook object for the 'waibu:onReady' event. The handler is invoked when the server is ready and logs a message indicating that the server is ready.
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
name | string | <optional> | 'waibu:onReady' | The name of the hook |
handler | onReadyHandler | The handler function for the hook |
- Source
(static) waibu:onRequest :external:THook
Hook object for the 'waibu:onRequest' event. The handler is invoked when a request is received and logs the request details, including the method, URL, and IP address.
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
level | number | <optional> | 5 | The level of the hook |
name | string | <optional> | 'waibu:onRequest' | The name of the hook |
handler | onRequestHandler | The handler function for the hook |
- Source
(static) waibu:onResponse :external:THook
Hook object for the 'waibu:onResponse' event. The handler is invoked when a response is sent and logs the response details, including the method, URL, status code, and elapsed time.
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
level | number | <optional> | 5 | The level of the hook |
name | string | <optional> | 'waibu:onResponse' | The name of the hook |
handler | onResponseHandler | The handler function for the hook |
- Source
(static) waibu:onRoute :external:THook
Hook object for the 'waibu:onRoute' event. The handler is invoked when a new route is registered and adds the route options to the list of routes.
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
level | number | <optional> | 5 | The level of the hook |
name | string | <optional> | 'waibu:onRoute' | The name of the hook |
handler | onRouteHandler | The handler function for the hook |
- Source
(static) waibu:preParsing :external:THook
Hook object for the 'waibu:preParsing' event. The handler is invoked before parsing the request and attaches internationalization (i18n) support to the request and reply objects.
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
level | number | <optional> | 9 | The level of the hook |
name | string | <optional> | 'waibu:preParsing' | The name of the hook |
handler | onPreParsingHandler | The handler function for the hook |
- Source
Type Definitions
(async) onCloseHandler()
- Source
(async) onReadyHandler()
- Source
(async) onRequestHandler(req, reply)
| Name | Type | Description |
|---|---|---|
req | object | The request object |
reply | object | The reply object |
- Source
(async) onResponseHandler(req, reply)
| Name | Type | Description |
|---|---|---|
req | object | The request object |
reply | object | The reply object |
- Source
(async) onRouteHandler(options)
| Name | Type | Description |
|---|---|---|
options | object | The route options object |
- Source
(async) waibuPreParsingHandler(req, reply)
| Name | Type | Description |
|---|---|---|
req | object | The request object |
reply | object | The reply object |
- Source