Skip to content

Basic rate-limiting hook for Sails based on express-rate-limit

License

Notifications You must be signed in to change notification settings

sailscastshq/sails-hook-rate-limit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

sails-hook-rate-limit

This Sails hook is a wrapper of express-rate-limit

Installation

npm i --save sails-hook-rate-limit

Setup

Create a rate-limit.js config file in config/.

module.exports.rateLimit = {
  windowMs: 10 * 60 * 1000 // 10 minutes
  max: 100,
  standardHeaders: true, // Return rate limit info in the `RateLimit-*` headers
  legacyHeaders: false, // Disable the `X-RateLimit-*` headers
}

The config object takes the same properties and methods as described in the configuration docs of express-rate-limit