node.js - node request library return an error on api call -


i'm using bitly api shorten links: http://dev.bitly.com/links.html#v3_shorten in console log im getting error...

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 outputs error!,


Comments

Popular posts from this blog

Delphi XE2 Indy10 udp client-server interchange using SendBuffer-ReceiveBuffer -

Qt ActiveX WMI QAxBase::dynamicCallHelper: ItemIndex(int): No such property in -

Enable autocomplete or intellisense in Atom editor for PHP -