app.get('/hello', function(req, res){
var options = {
url: 'https://api.leancloud.cn/1.1/functions/fun1',
method: 'POST',
headers: {
'X-LC-Id': 'key1',
'X-LC-Key': 'key2',
'Content-Type': 'application/json'
}
};
function callback(error, response, body) {
if (!error ) {
var result = JSON.parse(JSON.parse(body).result);
console.log("result");
console.log(result);
res.json(result)
}
else{
console.log("error")
console.log(error)
console.log("response")
console.log(response)
}
}
request.post(options, callback);
});
沒有留言:
張貼留言