Created
August 13, 2014 02:45
-
-
Save goldalworming/d8497726c6256870fa76 to your computer and use it in GitHub Desktop.
comparing node-redis
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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