Skip to content

Commit

Permalink
Create a simple request counter as middleware
Browse files Browse the repository at this point in the history
  • Loading branch information
lmarkus committed Nov 23, 2013
1 parent 6efd4ff commit ea40b8a
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions lib/millionsServed.js
@@ -0,0 +1,18 @@
/**
* Created with IntelliJ IDEA.
* User: lmarkus
* Date: 11/22/13
* A very simple page counter middleware
*/

'use strict';

module.exports = function () {
var requestsServed = 0;

return function (req, res, next) {
requestsServed += 1;
console.log(requestsServed / 1000000 + ' Million Pages Served!');
next();
};
};

0 comments on commit ea40b8a

Please sign in to comment.