我正在使用Bitly api来缩短链接: http://dev.bitly.com/links.html#v3_shorten 但是在控制台日志中我得到一个错误...
var Bitly = require('bitly');
var bitly = new Bitly('key');
module.exports = function(req, res) {
var term = req.query.text;
handleSearchString(term, req, res);
};
function handleSearchString(term, req, res) {
var response;
try {
response = sync.await(request({
url: 'https://api-ssl.bitly.com/v3/link/shorten',
qs: {
//link: term,
'access_token': key,
'longUrl': term,
},
timeout: 15 * 1000
}, sync.defer()));
} catch (e) {
res.status(500).send('\nError!\n');
return;
}
var html = '<p> ' + response + ' </p>';
res.json([{
body: html
}]);
};
Console.log输出错误!,