Created
November 21, 2014 18:36
-
-
Save cjonagam/43ffd94625b9a80a5909 to your computer and use it in GitHub Desktop.
express + redis example
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 express = require('express'); | |
var app = express(); | |
var redis = require('redis'); | |
var client = redis.createClient(6379,'172.20.136.159',{}); | |
app.get('/', function (req, res) { | |
client.get("myname", function(err, reply) { | |
res.send(reply) | |
}); | |
}); | |
var server = app.listen(3000, function () { | |
var host = server.address().address | |
var port = server.address().port | |
console.log('Example app listening at http://%s:%s', host, port); | |
}); | |
setTimeout(function(){ | |
client.set("myname", "chakri and chakri"); | |
},1100); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment