new RouterFactory()
Main interface for Design Driven Router factory
Methods
addGlobalHandler(globalHandler) → {RouterFactory}
Add global handler to be applied prior to Router being generated.
Please note that you should not add a body handler inside that list. If you want to modify the body handler, please use RouterFactory#setBodyHandler
Please note that you should not add a body handler inside that list. If you want to modify the body handler, please use RouterFactory#setBodyHandler
Parameters:
| Name | Type | Description |
|---|---|---|
globalHandler |
function |
Returns:
this object
- Type
- RouterFactory
addSecurityHandler(securitySchemaName, handler) → {RouterFactory}
Mount to paths that have to follow a security schema a security handler
Parameters:
| Name | Type | Description |
|---|---|---|
securitySchemaName |
string | |
handler |
function |
Returns:
- Type
- RouterFactory
getOptions() → {Object}
Get options of router factory. For more info RouterFactoryOptions
Returns:
- Type
- Object
getRouter() → {Router}
Construct a new router based on spec. It will fail if you are trying to mount a spec with security schemes
without assigned handlers
Note: Router is constructed in this function, so it will be respected the path definition ordering.
Note: Router is constructed in this function, so it will be respected the path definition ordering.
Returns:
- Type
- Router
getValidationFailureHandler() → {function}
Returns:
- Type
- function
setBodyHandler(bodyHandler) → {RouterFactory}
Supply your own BodyHandler if you would like to control body limit, uploads directory and deletion of uploaded files
Parameters:
| Name | Type | Description |
|---|---|---|
bodyHandler |
BodyHandler |
Returns:
self
- Type
- RouterFactory
setExtraOperationContextPayloadMapper(extraOperationContextPayloadMapper) → {RouterFactory}
When set, this function is called while creating the payload of OperationRequest
Parameters:
| Name | Type | Description |
|---|---|---|
extraOperationContextPayloadMapper |
function |
Returns:
- Type
- RouterFactory
setNotImplementedFailureHandler(notImplementedFailureHandler) → {RouterFactory}
Set not implemented failure handler. It's called when you don't define an handler for a
specific operation. You can enable/disable this feature from
RouterFactoryOptions
Parameters:
| Name | Type | Description |
|---|---|---|
notImplementedFailureHandler |
function |
Returns:
this object
- Type
- RouterFactory
setOptions(options) → {RouterFactory}
Set options of router factory. For more info RouterFactoryOptions
Parameters:
| Name | Type | Description |
|---|---|---|
options |
Object |
Returns:
- Type
- RouterFactory
setValidationFailureHandler(validationFailureHandler) → {RouterFactory}
Set default validation failure handler. You can enable/disable this feature from
RouterFactoryOptions
Parameters:
| Name | Type | Description |
|---|---|---|
validationFailureHandler |
function |
Returns:
this object
- Type
- RouterFactory