[Hidden-tech] node.js question

Lynn Scharf lynn at silverleafgeospatial.com
Fri Jan 9 14:44:44 EST 2015


...figure it out.  For some mysterious reason, just asking the question
sometimes makes solving something easier.
In case this is useful to anyone, here was my solution.  I used a few
outside libraries to make things easier.
I'll also post to stackoverflow, for more public usefulness.

var http = require("http");
var urllib = require('urllib');
var Promise = require("bluebird");

var header = {
    'Content-Type': 'application/json',
    'Content-Length': 0
  }
var option = {
    'dataType': 'json'
}
urllib.request('my.url.com', {
  method: 'POST',
  headers: header,
  options: option
}, function (err, data, res) {
      var whatIWasLookingFor = JSON.parse(data));
});


On Fri, Jan 9, 2015 at 12:58 PM, Lynn Scharf <lynn at silverleafgeospatial.com>
wrote:

> Hi,
>
> I think there are some node.js folks on this list, and wondered if I could
> get some feedback?
>
> I am interested in replacing the curl calls described in this API
> http://docs.cartodb.com/cartodb-platform/maps-api.html with node.js.  So
> far I have been successful in replacing anything that is a simple GET type
> request, but all of my POST or header manipulation attempts fail.
>
> Are these requests something that node.js is capable of, or am I wandering
> down the wrong path?
>
> Thank you!
> Lynn
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.hidden-tech.net/pipermail/hidden-discuss/attachments/20150109/6c0cde81/attachment.html 


Google

More information about the Hidden-discuss mailing list