/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.
- Source
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.
| Name | Type | Description |
|---|---|---|
req | req | HTTP request. |
res | Object | HTTP response. |
req.params | Object | Request parameter. |
params.provider | string | Provider module to handle the request. |
- Source
The promise resolves into the response from the provider modules method.
- Type:
- Promise