app

Node.js Express application API Endpoints.

Source:

Requires

  • module:bodyParser
  • module:express
  • module:@google-cloud/bigquery
  • module:@google-cloud/firestore
  • module:path

Namespaces

api

Methods

(inner) bynderApiLimiter() → {function}

Rate-limiting middleware for Express used to ensure we do not exceed the Bynder API request limit of 4500 request per 5 minute time frame.

Global rate-limiting is configured using the extensible service proxy IP in order to slow down all request before the Bynder API request limit is reached.

Returns:
Type Description
function
Source:
See:

(inner) bynderApiSlowDown() → {function}

Middleware for Express that slows down responses rather than blocking them outright.

Global slow down is configured using the extensible service proxy IP in order to slow down all request before the Bynder API request limit of 4500 request per 5 minute time frame is reached.

Response rate will be slowed down after a requestor reaches 4000 request in a 5-minute time frame by adding 500ms of delay per request above 4000.

A req.slowDown property is added to all requests with the following fields: limit: The options.delayAfter value (defaults to 1) current: The number of requests in the current window remaining: The number of requests remaining before rate-limiting begins resetTime: When the window will reset and current will return to 0, and remaining will return to limit (in milliseconds since epoch - compare to Date.now()). Note: this field depends on store support. It will be undefined if the store does not provide the value. delay: Amount of delay imposed on current request (milliseconds)

Returns:
Type Description
function
Source:
See:

(async, inner) bynderWebhook(req, res)

Bynder webhook.

This endpoint is rate limited to 4500 request per 5 minute time frame.

Response rate will be slowed down after a requestor reaches 4000 request in a 5-minute time frame by adding 500ms of delay per request above 4000.

Request, Response and Next are Callback functions. You can provide multiple callback functions that behave just like middleware, except that these callbacks can invoke next('route') to bypass the remaining route callback(s). You can use this mechanism to impose pre-conditions on a route, then pass control to subsequent routes if there is no reason to proceed with the current route.

Parameters:
Name Type Description
req object

The req object represents the HTTP request and has properties for the request query string, parameters, body, HTTP headers, and so on. In this documentation and by convention, the object is always referred to as req (and the HTTP response is res) but its actual name is determined by the parameters to the callback function in which you are working.

res object

The res object represents the HTTP response that an Express app sends when it gets an HTTP request. In this documentation and by convention, the object is always referred to as res (and the HTTP request is req) but its actual name is determined by the parameters to the callback function in which you are working. The res object is an enhanced version of Node’s own response object and supports all

Source:
See:

(inner) cache(duration) → {function}

Configure cache middleware which looks for a cached value using the request URL as the key. When found the cached response is sent. When not found the Express send function is wrapped to cache the response before sending it to the client and then calling the next middleware.

Parameters:
Name Type Description
duration number

Time in ms (via setTimeout) after which the value will be removed from the cache.

Returns:
Type Description
function
Source:

(async, inner) docs(path, req, res)

Get Product Enrichment JavaScript API documentation.

Parameters:
Name Type Description
path string

The path for which the middleware function is invoked; can be any of: A string representing a path. A path match pattern. A regular expression pattern to match paths. An array of combinations of the above.

req object

The req object represents the HTTP request and has properties for the request query string, parameters, body, HTTP headers, and so on. In this documentation and by convention, the object is always referred to as req (and the HTTP response is res) but its actual name is determined by the parameters to the callback function in which you are working.

res object

The res object represents the HTTP response that an Express app sends when it gets an HTTP request. In this documentation and by convention, the object is always referred to as res (and the HTTP request is req) but its actual name is determined by the parameters to the callback function in which you are working. The res object is an enhanced version of the Node response object and supports all

Source:
See:

(inner) get/auth/info()

Returns request JWT authentication information. A JWT is a JSON Web Token is an open standard access token format for use in HTTP Authorization headers and URI query parameters.

Source:
See:

(inner) get/auth/info()

Returns request Google id Token authentication information. A Google id Token is a JSON Web Token (JWT) that contains the OpenID Connect fields needed to identify a Google user account or service account, and that is signed by Google's authentication service, https://accounts.google.com.

Source:

(async, inner) getProduct(path, req, res, next)

Get Product data from Google Cloud Firestore.

Request, Response and Next are Callback functions. You can provide multiple callback functions that behave just like middleware, except that these callbacks can invoke next('route') to bypass the remaining route callback(s). You can use this mechanism to impose pre-conditions on a route, then pass control to subsequent routes if there is no reason to proceed with the current route.

Parameters:
Name Type Description
path string

The path for which the middleware function is invoked; can be any of: A string representing a path. A path match pattern. A regular expression pattern to match paths. An array of combinations of the above. Defaults to '/' (root path)

req object

The req object represents the HTTP request and has properties for the request query string, parameters, body, HTTP headers, and so on. In this documentation and by convention, the object is always referred to as req (and the HTTP response is res) but its actual name is determined by the parameters to the callback function in which you are working.

res object

The res object represents the HTTP response that an Express app sends when it gets an HTTP request. In this documentation and by convention, the object is always referred to as res (and the HTTP request is req) but its actual name is determined by the parameters to the callback function in which you are working. The res object is an enhanced version of Node’s own response object and supports all

next object

For errors returned from asynchronous functions invoked by route handlers and middleware, you must pass them to the next() function, where Express will catch and process them. Bypass the remaining route callbacks(s) and invoke the Google Error Reporting middleware handler.

Source:
See:

(async, inner) health(path, req, res)

Health check endpoint.

Parameters:
Name Type Description
path string

The path for which the middleware function is invoked; can be any of: A string representing a path. A path match pattern. A regular expression pattern to match paths. An array of combinations of the above.

req object

The req object represents the HTTP request and has properties for the request query string, parameters, body, HTTP headers, and so on. In this documentation and by convention, the object is always referred to as req (and the HTTP response is res) but its actual name is determined by the parameters to the callback function in which you are working.

res object

The res object represents the HTTP response that an Express app sends when it gets an HTTP request. In this documentation and by convention, the object is always referred to as res (and the HTTP request is req) but its actual name is determined by the parameters to the callback function in which you are working. The res object is an enhanced version of the Node response object and supports all

Source:
See:

(inner) wrap(fn) → {function}

ES6 wrapper function which catches errors and passes them to next. The async/await proposal behaves just like a promise generator, but it can be used in more places (like class methods and arrow functions).

Parameters:
Name Type Description
fn function
Returns:
Type Description
function
Source: