FILEEM

POWER OF DREAM

nodejs curl 输出内容

安装

cnpm i child_process --save

curl

var child_process = require("child_process");
    var curl = `curl --data '{"jsonrpc": "2.0", "method": "call", "params":[0,"get_block",[15893]], "id": 1}' http://localhost:11011`
    var child = child_process.exec(curl, function(err, stdout, stderr) {
        console.log(curl,'\n',stdout);
         resObj.message = stdout
         res.end(JSON.stringify(resObj))
    });

《nodejs curl 输出内容》

点赞