Journey JSON in node.js

I’m playing around with Journey on node and I only realized that the router is interpreting JSON requests objects as the value of the key that has an empty value:

In other words, when i post to the server a JSON object I get the following:

http://127.0.0.1:3000/> post /events
... {url : "test"}
HTTP/1.1 200 OK
Date: Tue, 21 Feb 2012 00:42:38 GMT
Server: journey/0.4.0
Content-Type: application/json;charset=utf-8
Content-Length: 67
Connection: keep-alive

{
    event: {
        _id: '10tPxx',
        resource: 'Event',
        {url : "test"}: ''
    }
}

As you can see the whole object is being considered as a string.

Here’s my Journey related code:

exports.createRouter = function(resource){
    var router = new (journey.Router)({
        api: 'basic'
    });
    router.path(//events/, function(){
....
        this.post().bind(function(res, event){
            console.log(event);
            resource.create(event, function(err, result){
                if(err){
                    return res.send(500, {}, {error: err.error});
                }
                res.send(200, {}, { event: result});
            });
        });
...
    });
    return router;
};

The printout of the console is:

{ '{url : "test"}': '' }

What could possibly be wrong?

Problem courtesy of: mabounassif

Node.js Recipes责编内容来自:Node.js Recipes (源链) | 更多关于

阅读提示:酷辣虫无法对本内容的真实性提供任何保证,请自行验证并承担相关的风险与后果!
本站遵循[CC BY-NC-SA 4.0]。如您有版权、意见投诉等问题,请通过eMail联系我们处理。
酷辣虫 » 前端开发 » Journey JSON in node.js

喜欢 (0)or分享给?

专业 x 专注 x 聚合 x 分享 CC BY-NC-SA 4.0

使用声明 | 英豪名录