Extends
Members
(static) dependencies :Array.<string>
- Source:
Class dependencies:
['app', 'config', 'http.error.mapper', 'router.controller', 'router.route']
.
Methods
(async) handleRequest(route, request, response)
- Source:
Handle HTTP request.
Parameters:
Name | Type | Description |
---|---|---|
route |
http.Route | Current route instance. |
request |
request | Current request instance. |
response |
response | Current response instance. |
Returns:
The processed response.
- Type
- Promise.<response>
handleRouteNotFound(request, response)
- Source:
Handle request when the route was not found.
Parameters:
Name | Type | Description |
---|---|---|
request |
request | Current request instance. |
response |
response | Current response instance. |
Returns:
The processed response.
- Type
- Promise.<response>
(async) handleRequestWith(promise)
- Source:
Handle current request with give promise or result.
Parameters:
Name | Type | Description |
---|---|---|
promise |
Promise.<*> | * | The current request process. |
Returns:
The async process promise.
- Type
- Promise
(async) handleRequestWithClosure()
- Source:
Handle current request with closure attached to route.
Returns:
The async process promise.
- Type
- Promise
(async) handleRequestWithController()
- Source:
Handle current request with controller attached to route.
Returns:
The async process promise.
- Type
- Promise
getInternalCallResultHandler(resolve, reject)
- Source:
Get an internal call result handler to either resolve or
reject the given request based on received HTTP code.
Parameters:
Name | Type | Description |
---|---|---|
resolve |
function | The promise resolving. |
reject |
function | The promise rejection. |
Returns:
The internal call result handler.
- Type
- function
prepareHandling(objects)
- Source:
Prepare request handling.
Parameters:
Name | Type | Description |
---|---|---|
objects |
Object | The current route, request and response instances. |
(async) terminateHandling()
- Source:
Terminate request handling.
Returns:
The current response.
- Type
- response
(async) handleRequestException(exception)
- Source:
Handle exception that occurred during request handling.
Parameters:
Name | Type | Description |
---|---|---|
exception |
Error | The throw exception. |
Returns:
The async process promise.
- Type
- Promise
callControllerAction()
- Source:
Call route controller action.
Returns:
The request handling process.
- Type
- Promise.<*> | *
resolveControllerAction()
- Source:
Resolve controller action method.
Returns:
The bound controller method.
- Type
- function
getHttpTimeoutPromise()
- Source:
Get HTTP timeout promise.
This promise will be rejected after a configured time lapse.
Returns:
The promise of a timeout error.
- Type
- Promise.<Error>
getHttpTimeoutException()
- Source:
Get HTTP timeout exception.
Returns:
The timeout error.
throwControllerActionNotFound(controller)
- Source:
Throw custom TypeError indicating that the controller action was not found.
Parameters:
Name | Type | Description |
---|---|---|
controller |
string | The controller action. |
Throws:
-
Indicates that the action was not found in the given controller.
- Type
- TypeError
getErrorInstanceFromHttpStatus(status)
- Source:
Get HTTP error that matches the given status.
Parameters:
Name | Type | Description |
---|---|---|
status |
number | The HTTP status code. |
Returns:
The HTTP Error that matches the status, or generic error.