Spaces:
Sleeping
Sleeping
Update server.js
Browse files
server.js
CHANGED
@@ -16,15 +16,15 @@ function getRandomApiKey() {
|
|
16 |
}
|
17 |
|
18 |
const limiter = rateLimit({
|
19 |
-
windowMs: 60 * 1000, //
|
20 |
-
max:
|
21 |
handler: function (req, res) {
|
22 |
return res.status(429).json("wait");
|
23 |
},
|
24 |
});
|
25 |
|
26 |
// Применение ограничителя скорости перед обработчиком маршрута /pl и /crebeta
|
27 |
-
|
28 |
|
29 |
const start = `${process.env.start}`;
|
30 |
|
|
|
16 |
}
|
17 |
|
18 |
const limiter = rateLimit({
|
19 |
+
windowMs: 60 * 1000, // 60 секунд
|
20 |
+
max: 8, // лимит каждые 60 секунд на IP
|
21 |
handler: function (req, res) {
|
22 |
return res.status(429).json("wait");
|
23 |
},
|
24 |
});
|
25 |
|
26 |
// Применение ограничителя скорости перед обработчиком маршрута /pl и /crebeta
|
27 |
+
app.use('/pl', limiter);
|
28 |
|
29 |
const start = `${process.env.start}`;
|
30 |
|