Methods
(async, static) attachIntl(detector, req, reply)
Attach internationalization (i18n) methods to the request object as defined by decorator during plugin startup. It will set the language, translation, and formatting functions.
| Name | Type | Description |
|---|---|---|
detector | Array.<string> | The list of detectors to use ('path', 'qs', 'header') |
req | object | The request object |
reply | object | The reply object |
- Source
(async, static) handleCompress(options) → {Promise.<void>}
Handle compression middleware. It will register the compression middleware with the specified options.
| Name | Type | Description |
|---|---|---|
options | object | The options for the compression middleware |
- Source
- Type:
- Promise.<void>
(async, static) handleCors(options) → {Promise.<void>}
Handle CORS middleware. It will register the CORS middleware with the specified options.
| Name | Type | Description |
|---|---|---|
options | object | The options for the CORS middleware |
- Source
- Type:
- Promise.<void>
(async, static) handleHelmet(options) → {Promise.<void>}
Handle Helmet middleware. It will register the Helmet middleware with the specified options.
| Name | Type | Description |
|---|---|---|
options | object | The options for the Helmet middleware |
- Source
- Type:
- Promise.<void>
(async, static) handleMultipartBody(options) → {Promise.<void>}
Handle multipart body middleware. It will register the multipart middleware with the specified options.
| Name | Type | Description |
|---|---|---|
options | object | The options for the multipart middleware |
- Source
- Type:
- Promise.<void>
(async, static) handleRateLimit(options) → {Promise.<void>}
Handle rate limit middleware. It will register the rate limit middleware with the specified options.
| Name | Type | Description |
|---|---|---|
options | object | The options for the rate limit middleware |
- Source
- Type:
- Promise.<void>
(async, static) handleXmlBody(opts) → {Promise.<void>}
Handle XML body middleware. It will register the XML body parser middleware with the specified options.
Requires the https://github.com/ardhi/bajo-extra plugin to be installed.
| Name | Type | Description |
|---|---|---|
opts | object | The options for the XML body parser middleware |
- Source
- Type:
- Promise.<void>
(async, static) mergeRouteHooks(def, withHandler) → {Promise.<void>}
Merge route hooks. It will merge the route hooks with the specified options.
| Name | Type | Description |
|---|---|---|
def | object | The route definition |
withHandler | boolean | Whether to include the handler hook |
- Source
- Type:
- Promise.<void>
(async, static) reroutedPath(path, mapper) → {Promise.<(string|undefined)>}
Reroute the given path based on the provided mapper.
| Name | Type | Description |
|---|---|---|
path | string | The original path |
mapper | object | The mapping of original paths to new paths |
- Source
- The rerouted path or undefined if not found
- Type:
- Promise.<(string|undefined)>
(async, static) routeHook(ns) → {Promise.<void>}
Register route hooks for the specified namespace.
| Name | Type | Description |
|---|---|---|
ns | string | The namespace for which to register the hooks |
- Source
- Type:
- Promise.<void>
(inner) detect(detector, req, reply) → {void}
Detect the language based on the specified detectors (path, query string, header) and set it on the request object.
| Name | Type | Description |
|---|---|---|
detector | Array.<string> | The list of detectors to use ('path', 'qs', 'header') |
req | object | The request object |
reply | object | The reply object |
- Source
- Type:
- void
Type Definitions
TWebAppBoot
- Object
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
level | number | <optional> | 999 | The boot level of the Waibu WebApp, indicating the order in which it should be initialized relative to other components. |
handler | module:WebApp~bootHandler | The boot handler function responsible for initializing the application during the boot process. |
- Source
(async) bootHandler() → {Promise.<void>}
- Source
- Type:
- Promise.<void>