Skip to content

Instantly share code, notes, and snippets.

@fbrnc
Created June 9, 2016 04:27
Show Gist options
  • Save fbrnc/19c3ce69bbc5b4083b5a3653109f2148 to your computer and use it in GitHub Desktop.
Save fbrnc/19c3ce69bbc5b4083b5a3653109f2148 to your computer and use it in GitHub Desktop.
Simple hit counter with node.js and Redis
var db = require("redis-client").createClient();
require("http").createServer(function(request, response) {
db.incr("count",function(err, reply) {
response.writeHead(200, { "Content-Type": "text/plain" });
response.write(reply.toString());
response.end();
});
}).listen(8181);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment