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.

Parameters:
NameTypeDescription
detectorArray.<string>

The list of detectors to use ('path', 'qs', 'header')

reqobject

The request object

replyobject

The reply object

(async, static) handleCompress(options) → {Promise.<void>}

Handle compression middleware. It will register the compression middleware with the specified options.

Parameters:
NameTypeDescription
optionsobject

The options for the compression middleware

Returns:
Type: 
Promise.<void>

(async, static) handleCors(options) → {Promise.<void>}

Handle CORS middleware. It will register the CORS middleware with the specified options.

Parameters:
NameTypeDescription
optionsobject

The options for the CORS middleware

Returns:
Type: 
Promise.<void>

(async, static) handleHelmet(options) → {Promise.<void>}

Handle Helmet middleware. It will register the Helmet middleware with the specified options.

Parameters:
NameTypeDescription
optionsobject

The options for the Helmet middleware

Returns:
Type: 
Promise.<void>

(async, static) handleMultipartBody(options) → {Promise.<void>}

Handle multipart body middleware. It will register the multipart middleware with the specified options.

Parameters:
NameTypeDescription
optionsobject

The options for the multipart middleware

Returns:
Type: 
Promise.<void>

(async, static) handleRateLimit(options) → {Promise.<void>}

Handle rate limit middleware. It will register the rate limit middleware with the specified options.

Parameters:
NameTypeDescription
optionsobject

The options for the rate limit middleware

Returns:
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.

Parameters:
NameTypeDescription
optsobject

The options for the XML body parser middleware

Returns:
Type: 
Promise.<void>

(async, static) mergeRouteHooks(def, withHandler) → {Promise.<void>}

Merge route hooks. It will merge the route hooks with the specified options.

Parameters:
NameTypeDescription
defobject

The route definition

withHandlerboolean

Whether to include the handler hook

Returns:
Type: 
Promise.<void>

(async, static) reroutedPath(path, mapper) → {Promise.<(string|undefined)>}

Reroute the given path based on the provided mapper.

Parameters:
NameTypeDescription
pathstring

The original path

mapperobject

The mapping of original paths to new paths

Returns:
  • 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.

Parameters:
NameTypeDescription
nsstring

The namespace for which to register the hooks

Returns:
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.

Parameters:
NameTypeDescription
detectorArray.<string>

The list of detectors to use ('path', 'qs', 'header')

reqobject

The request object

replyobject

The reply object

Returns:
Type: 
void

Type Definitions

TWebAppBoot

Type:
  • Object
Properties
NameTypeAttributesDefaultDescription
levelnumber<optional>
999

The boot level of the Waibu WebApp, indicating the order in which it should be initialized relative to other components.

handlermodule:WebApp~bootHandler

The boot handler function responsible for initializing the application during the boot process.

(async) bootHandler() → {Promise.<void>}

Returns:
Type: 
Promise.<void>