Skip to content

Instantly share code, notes, and snippets.

@rasputnik
Created September 4, 2010 13:03
Show Gist options
  • Select an option

  • Save rasputnik/565169 to your computer and use it in GitHub Desktop.

Select an option

Save rasputnik/565169 to your computer and use it in GitHub Desktop.
module.exports = function counterSetup(logcheckpoint) {
var hitcount = 0;
var logcheckpoint = logcheckpoint || 1000;
return function hitCount(req, res, next) {
hitcount++;
if (hitcount % logcheckpoint == 0 ) {
console.log(hitcount + " hits");
}
next();
};
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment