/provider/cloudfront
The cloudfront provider module exports a method to fetch resources from an AWS cloudfront service.
The fetch requests and their status can be logged with the 'cloudfront' log.
The provider module requires the cloudfront signer which requires a cloudfront key. If not provided the module will export null.
- Source
Requires
Methods
(inner) cloudfront(req) → {Promise.<(Object|Error)>}
The cloudfront provider method will parse an URL from the request parameter and sign this request through the cloudfront signer module.
The module will attempt to fetch a resource from the signed request URL.
An error will be returned if the signing or fetching fails.
The fetched will resource body will be parsed as JSON if the URL ends in .json. Otherwise the resource body will be parsed as text.
| Name | Type | Description |
|---|---|---|
req | req | | Request object or URL string. |
| Name | Type | Attributes | Description |
|---|---|---|---|
req.params | object | <optional> | Request params. |
params.url | string | URL in request param. |
- Type:
- Promise.<(Object|Error)>