MiddlewareModule

middleware. MiddlewareModule

Adds useful Express middleware to the server stack

Constructor

new MiddlewareModule()

Source:

Extends

  • AbstractModule

Methods

bodyParserJson() → {function}

Description:
  • Parses incoming JSON data to req.body
Source:
See:
Returns:
Express middleware function
Type
function

bodyParserUrlEncoded() → {function}

Description:
  • Parses incoming URL-encoded data to req.body
Source:
See:
Returns:
Express middleware function
Type
function

fileUploadParser(expectedFileTypes, options) → {function}

Description:
  • Handles incoming file uploads
Source:
Parameters:
Name Type Description
expectedFileTypes Array.<String> List of file types to accept
options FileUploadOptions
Returns:
The Express handler
Type
function

(async) init()

Source:

setDefaultFileOptions(options) → {FileUploadOptions}

Description:
  • Sets default file upload options
Source:
Parameters:
Name Type Description
options object The initial options object
Returns:
Type
FileUploadOptions

urlUploadParser(expectedFileTypes, options) → {function}

Description:
  • Handles incoming file uploads via URL
Source:
Parameters:
Name Type Description
expectedFileTypes Array.<String> List of file types to accept
options FileUploadOptions
Returns:
The Express handler
Type
function