相关疑难解决方法(0)

如何在Express应用程序中使用JSON POST数据

我将以下JSON字符串发送到我的服务器.

(
        {
        id = 1;
        name = foo;
    },
        {
        id = 2;
        name = bar;
    }
)
Run Code Online (Sandbox Code Playgroud)

在服务器上我有这个.

app.post('/', function(request, response) {

    console.log("Got response: " + response.statusCode);

    response.on('data', function(chunk) {
        queryResponse+=chunk;
        console.log('data');
    });

    response.on('end', function(){
        console.log('end');
    });
});
Run Code Online (Sandbox Code Playgroud)

当我发送字符串时,它显示我得到了200响应,但其他两种方法从未运行.这是为什么?

json node.js express

287
推荐指数
6
解决办法
39万
查看次数

标签 统计

express ×1

json ×1

node.js ×1