在Redis上将缓冲区转换为字符串获取Node.js Heroku应用程序

ame*_*hta 4 heroku redis node.js

这是我非常基本的GET功能

app.get('/', function(request, response) {
  response.contentType('application/json');
  var lid = request.param("lid");
  client.llen(lid, function(reply, len){
      client.lrange(lid, 0, len-1, function(reply, messages){
      console.log(messages);
      response.send(messages);
    })
  });
});
Run Code Online (Sandbox Code Playgroud)

出于某种原因,控制台输出和我得到的响应看起来像

[ <Buffer 5b 7b 22 6c 61 77 79 65 72 5f ... 61 64 61 74 61 22 3a 22 36 22 7d 5d> ]
Run Code Online (Sandbox Code Playgroud)

我将这些存储为JSON字符串:

client.lpush(lid, JSON.stringify(to_store))
Run Code Online (Sandbox Code Playgroud)

为什么我的响应不是JSON字符串?

谢谢.

Eld*_*rov 8

尝试

console.log(messages.toString());
Run Code Online (Sandbox Code Playgroud)