UploadFile

flitter-upload/middleware/UploadFile~ UploadFile

Middleware that uploads the files provided in the request to the default backend store and places references to the instantiated module:flitter-upload/model/File~File records in "request.uploads".


Constructor

new UploadFile()

Extends

Members

(static) services

Defines the services required by this middleware.

(private) _di_allow_defer :boolean

If true, the injector will defer the class if the class requests any services that the container is missing. These services are filled in later and added to the prototype and any instances. True by default.

Type:
  • boolean

(private) _di_deferred_instances :Array.<module:flitter-di/src/Injectable~Injectable>

Collection of instances of this class that need to have the deferred service instances injected into them when the deferred services are finally provided.

(private) _di_deferred_services :Array.<string>

List of services that were deferred and not provided at the time of injection.

Type:
  • Array.<string>

Methods

(async) test(req, res, next, argsopt) → {Promise.<void>}

Executes the middleware. For any files that exist in the request, they will be stored in the module:flitter-upload/store/Store~Store that is configured as the default.

This creates instances of module:flitter-upload/model/File~File and places them in req.uploads in an object mapping the upload field name to the File model instance.

Parameters:
Name Type Attributes Default Description
req express/request

the request

res express/response

the response

next function

the next function in the chain

args object <optional>
{}

optional arguments

Returns:
Type
Promise.<void>