Skip to content

Instantly share code, notes, and snippets.

@goldalworming
Created August 13, 2014 02:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save goldalworming/d8497726c6256870fa76 to your computer and use it in GitHub Desktop.
Save goldalworming/d8497726c6256870fa76 to your computer and use it in GitHub Desktop.
comparing node-redis
var http = require("http"), server,
redis_client = require("redis").createClient();
server = http.createServer(function (request, response) {
response.writeHead(200, {
"Content-Type": "text/plain"
});
redis_client.get('id:'+'value', function(err, idclient) {
if (err != null) {
console.log(err);
}
response.write(idclient+'\n');
response.end();
});
}).listen(9091);
server.on('error', function(err){
console.log(err);
process.exit(1);
});
exports.install = function(framework) {
framework.route('/', returnvalue);
};
function returnvalue() {
var self = this;
var rc = redis.createClient();
rc.get('id:'+'value', function(err, idclient) {
if (err != null) {
self.view500(err);
return;
}
self.plain(idclient)
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment