var request = require('request');
var fs=require("fs");
var program = {
script :"print('hello\nworld')",
language: "python3",
versionIndex: "0",
clientId: "clientID",
clientSecret:"clientSecret"
};
request({
url: 'https://api.jdoodle.com/execute',
method: "POST",
json: program
},
function (error, response, body) {
console.log('error:', error);
console.log('statusCode:', response && response.statusCode);
console.log('body:', body);
});
输出:
error: null
statusCode: 200
body: { output: '\njdoodle.c:1:7: warning: missing terminating \' character\n print(\'hello\n ^\njdoodle.c:1:1: error: missing terminating \' c
haracter\n print(\'hello\n ^\njdoodle.c:2:6: warning: missing terminating \' character\n world\')\n ^\njdoodle.c:2:1: error: missing terminating
\' character\n world\')\n ^\njdoodle.c:2:1: error: expected \')\' at end of input\n',
statusCode: 200,
memory: null,
cpuTime: null }
有没有其他方法可以将代码发送到编译器 api 来执行它请建议我 感谢您提前帮助我