add integration tests for checking service token with overrides

This commit is contained in:
Maidul Islam
2023-04-12 12:00:27 -07:00
parent e2c67ffbef
commit dda5f75450
4 changed files with 159 additions and 69 deletions
+12 -4
View File
@@ -15,7 +15,7 @@ const apiLimiter = rateLimit({
});
// 10 requests per minute
const authLimiter = rateLimit({
const authLimit = rateLimit({
windowMs: 60 * 1000,
max: 10,
standardHeaders: true,
@@ -36,8 +36,16 @@ const passwordLimiter = rateLimit({
}
});
export {
apiLimiter,
const authLimiter = (req: any, res: any, next: any) => {
if (process.env.NODE_ENV === 'production') {
authLimit(req, res, next);
} else {
next();
}
};
export {
apiLimiter,
authLimiter,
passwordLimiter
passwordLimiter
};