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字符串?
谢谢.
| 归档时间: |
|
| 查看次数: |
4471 次 |
| 最近记录: |