I am trying to time how long it takes to respond to requests.
Right now I create a timestamp on the httpServer request event the problem is that httpServerResponse does not emit end and the end function to finish the response is called in different locations and I dont want to add this code at all these locations.
Is there a better way to do this?
var server = http.createServer(); server.on('request', dispatch); function dispatch(req, res){ var start = Date.now(); // No such event so never fired res.on('end', function(){ console.log('requests.time', Date.now() - start); }); generateResponse(req, res); }