Route

Route

Route class is the basic class every route should extend. The idea is that an incoming request generates a FlamingoOperation which is passed through the route and used to store metadata.

Constructor

new Route(config, method, path, descriptionopt)

Parameters:
Name Type Attributes Default Description
config Config
method string the routes http method
path string the routes url path
description string <optional>
'' route description
Source:

Methods

buildOperation(request, reply) → {Promise.<FlamingoOperation>}

Function to build the flamingo operation based on the incoming request + reply function. Each extending class should call super.buildOperation to get a minimal working flamingo operation.
Parameters:
Name Type Description
request Request
reply function
Source:
See:
Returns:
Type
Promise.<FlamingoOperation>

handle(operation)

Function that is called for each request. To send the response, call `operation.reply()`.
Parameters:
Name Type Description
operation FlamingoOperation
Source:
See:

handleError(request, reply, error, operationopt) → {*}

Function to log and reply errors
Parameters:
Name Type Attributes Description
request Request
reply function function that replies to the request
error Error
operation FlamingoOperation <optional>
Source:
Returns:
reply return value
Type
*

hapiConfig(defaults)

Function to build the hapi route config object
Parameters:
Name Type Description
defaults Object
Source:
See: