Put rate limited error in JSON

This commit is contained in:
hiimgoodpack 2021-03-26 10:59:24 -04:00
parent e7da5de255
commit b6f909ee5d
Signed by untrusted user: hiimgoodpack
GPG key ID: 4E0E62733C14AE69

View file

@ -15,7 +15,10 @@ const app = express.Router();
const createAccountLimiter = rateLimit({ const createAccountLimiter = rateLimit({
windowMs: 60 * 60 * 1000, // 1 hour window windowMs: 60 * 60 * 1000, // 1 hour window
max: 10, // start blocking after 5 requests max: 10, // start blocking after 5 requests
message: "You are being rate limited" message: JSON.stringify({
error: true,
message: "ERROR_RATE_LIMITED"
})
}); });
mongoose.connect(config.mongoUrl, {useNewUrlParser: true, useUnifiedTopology: true}); mongoose.connect(config.mongoUrl, {useNewUrlParser: true, useUnifiedTopology: true});
@ -211,4 +214,4 @@ app.post("/browser/token/clear", authenticateEndpoint((req, res) => {
res.sendStatus(200); res.sendStatus(200);
})); }));
module.exports = app; module.exports = app;