/provider

The provider module imports the cloudinary, file, and s3 provider modules and exports a provider method that looks up a provider module method matching the provider request parameter and passes the req/res objects as argument to the matched method.

Requires

  • module:/cloudinary
  • module:/file
  • module:/s3

Methods

(async, inner) provider(req, res) → {Promise}

The provider method looks up a provider module method matching the provider request parameter and passes the req/res objects as argument to the matched method.

The response from the method is parsed as JSON if the response is an object.

The default content type is text/plain but can be overridden by the content_type request parameter if the value is in the allowed content types list.

The content type is derived from the requested resource if the URL ends with a JavaScript extension.

Parameters:
NameTypeDescription
reqreq

HTTP request.

resObject

HTTP response.

req.paramsObject

Request parameter.

params.providerstring

Provider module to handle the request.

Returns:

The promise resolves into the response from the provider modules method.

Type: 
Promise