Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import { joiValidate, includesDomainInCommaList } from "./utils";
import { trackUrl } from "./tracking";
const store = new Brute.MemoryStore();
const bruteForce = new Brute(store, {
freeRetries: BRUTE_FREE_RETRIES,
lifetime: BRUTE_LIFETIME
});
const rateLimiter = RateLimit({
windowMs: RATE_LIMIT_TIME,
max: RATE_LIMIT_MAX
});
const publicRateLimiter = RateLimit({
windowMs: PUBLIC_RATE_LIMIT_TIME,
max: PUBLIC_RATE_LIMIT_MAX
});
const speedLimiter = slowDown({
windowMs: SPEED_LIMIT_TIME,
delayAfter: SPEED_LIMIT_COUNT,
delayMs: SPEED_LIMIT_DELAY
});
/**
* Handle any errors for Express
*/
export const errorHandler = (
error: any,
req: Request,
res: Response,
next: NextFunction
) => {
if (error.api_error_code) {
// Handle Chargebee errors