A Simple Hit Counter with Node.js and Redis


Trying out a bit of Simon Willison's Redis Tutorial (and "Node.js is genuinely exciting" post): this node.js script reads the HTTP referer header from a request, increments appropriate counters in a Redis database, then returns a 1x1px GIF image.

Update: it's difficult to embed the binary GIF image data here; it's basically the result of this: base64_decode("R0lGODlhAQABAJEAAP////////4BAgAAACH5BAQUAP8ALAAAAAABAAEAAAICRAEAOw==")