- 
                Notifications
    You must be signed in to change notification settings 
- Fork 44
Request Filter
        thiagobustamante edited this page May 19, 2017 
        ·
        6 revisions
      
    A Filter is a function that receives the request and the response object from express and must return a boolean value to inform if the given request should target the destination API or if it should be ignored.
Each filter must be defined on its own .js file.
Example:
/**
 * Where request and response are the original request and response objects created by [express](http://expressjs.com)
 */
module.exports = function (request, response) {
  return true;
};You can configure a request filter middleware:
- Admin Rest API: POST /midleware/filters
- SDK: sdk.middleware.addFilter(name, fileName);
- CLI: treeGatewayConfig middleware filter -a <name> ./filename.js