node-static
node-static copied to clipboard
setTimeout not working? Can't throttle server...
I'd essentially like to create a throttled server. I thought I could do something like this:
require('http').createServer(function (request, response) {
request.addListener('end', function () {
setTimeout(function () { fileServer.serve(request, response); }, 2000);
}).resume();
}).listen(8080);
As you can see, I've wrapped my server() call in a setTimeout. This doesn't seem to be working, though.
How can I throttle my server?