-
Notifications
You must be signed in to change notification settings - Fork 1
Description
Example:
you have an endpoint /createNote that you have setup with a rateLimit authmakerVerifyExpress.mongoRateLimited("createNote") and you are currently sending a single note per request so this just works. i.e. there is a one to one relationship between requests and the number of notes that you are creating.
say you upgrade your endpoint to be able to take a number of notes at once because fewer http requests are awesome 🎉 ... well now you might say have a limit of 10 notes created per day, the user calls /createNote 9 times with one note and then calls it once with 10 notes. The current implementation allows for a user to now have created 19 notes in a single day.
The way to solve this is to provide an optional function to the authmakerVerifyExpress.mongoRateLimited("createNote") call that gets passed req as its only parameter. this function will then return the number of audit trail items that it should create as part of this request and pass that down into authmaker-verify.