mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2024-11-12 02:17:21 +08:00
34 lines
693 B
JavaScript
34 lines
693 B
JavaScript
|
const rateLimit = require("express-rate-limit");
|
||
|
|
||
|
exports.limit60perhour = rateLimit({
|
||
|
windowMs: 60 * 60 * 1000, // 60 min
|
||
|
max: 60,
|
||
|
message: {
|
||
|
message: "Too many requests, please try again later",
|
||
|
},
|
||
|
});
|
||
|
|
||
|
exports.limit3perday = rateLimit({
|
||
|
windowMs: 24 * 60 * 60 * 1000, // 1 day
|
||
|
max: 3,
|
||
|
message: {
|
||
|
message: "Too many requests, please try again later",
|
||
|
},
|
||
|
});
|
||
|
|
||
|
exports.limit1persec = rateLimit({
|
||
|
windowMs: 60 * 1000,
|
||
|
max: 60,
|
||
|
message: {
|
||
|
message: "Too many requests, please try again later",
|
||
|
},
|
||
|
});
|
||
|
|
||
|
exports.limit500perhour = rateLimit({
|
||
|
windowMs: 60 * 60 * 1000,
|
||
|
max: 500,
|
||
|
message: {
|
||
|
message: "Too many requests, please try again later",
|
||
|
},
|
||
|
});
|