carbond.limiter.PolicyLimiter

PolicyLimiter allows you to specify a policy (see: LimiterPolicy) and a mechanism to group requests (see LimiterSelector) to be evaluated by the policy.

Class

class carbond.limiter.PolicyLimiter()

extends: Limiter

selector
Required
Description The selector used to group incoming requests.
policy
Required
Description The policy used to evaluate incoming requests.
initialize  
Arguments
Description Extends carbond.limiter.Limiter.initialize to initialize the policy and policy state.
process  
Arguments
  • req (express.request) – the current Request object
  • res (express.response) – the current Response object
  • next (Function) – continuation
Description Implements carbond.limiter.Limiter.process to apply policy using the grouping generated by selector and, finally, passing the request on if the policy allows or sending a 503 response if not.

class method

Reset the state across all policies.

Example