问题描述
我想为我的 API 创建一个速率限制层
使用 20 个 express-rate-limit
实例是个坏主意吗?
import * as rateLimit from 'express-rate-limit'
// import express,others...
const standard = {
hour: rateLimit({
windowMs: 60 * 60 * 1000,// 1 hour
max: 30,// limit each IP to 30 requests per windowMs
}),day: rateLimit({
windowMs: 24 * 60 * 60 * 1000,max: 100,}),week: rateLimit({
windowMs: 7 * 24 * 60 * 60 * 1000,max: 200,})
}
app.use(standard.hour)
app.use(standard.day)
app.use(standard.week)
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)