Friday, 26 May 2017

Using redis in an express route

I want to simply be able to store a value in a key in one route

/api/foo?redisKey="1" (set value for id=1)

then I want to get the value in another route.

/api/bar?redisKey="1" (get value for id=1)

However, redis is async so you have to wait for it to connect

client.on('connect', function() {
    //perform redis operations
});

I'm not sure how to synchronize this in my router. Is there anyone exprience with redis that could please help me out? :)



via Six six six

No comments:

Post a Comment