📜  express js根据速率限制访问 - Javascript代码示例

📅  最后修改于: 2022-03-11 15:02:10.011000             🧑  作者: Mango

代码示例1
const rateLimit = require('express-rate-limit');

const limiter = rateLimit({
  max: 100,
  windowMs: 60 * 60 * 1000,
  message: 'too many requests sent by this ip, please try again in an hour !'
});

app.use('', limiter);  // eg: app.use('/api', limiter);