> On Nov 13, 2014, at 12:59 PM, Alex Spencer <[email protected]> wrote:
> 
> Hi.
> 
> Imagine a simple route like this:
> 
> app.get('/test',
> apiCall1(),
> apiCall2(),
> apiCall3(),
> apiCall4(),
> apiCall5(),
> renderPage()
> 
> How would you prevent this code from being executed by the same client while 
> said client is spamming GET requests (either by refresh page or clicking 
> buttons, etc.) to the same route ?

I'd add another middleware at the head of the chain that keeps track of the 
accesses by a given client (session ID? IP address? Identifying a client can be 
its own problem, depending!), and errors (with next(an error here)) if the user 
is over-requesting. Defining that is up to you.


-- 
Job board: http://jobs.nodejs.org/
New group rules: 
https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
--- 
You received this message because you are subscribed to the Google Groups 
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/nodejs/D449823A-60EC-42CD-9433-929CFE38AF40%40nbtsc.org.
For more options, visit https://groups.google.com/d/optout.

Attachment: smime.p7s
Description: S/MIME cryptographic signature

Reply via email to