/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.

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.

Parameters:
NameTypeDescription
reqreq | string

Request object or URL string.

Properties
NameTypeAttributesDescription
req.paramsobject<optional>

Request params.

params.urlstring

URL in request param.

Returns:
Type: 
Promise.<(Object|Error)>