Roger Veciana
Roger Veciana

Reputation: 993

Using d3-request from node

I'm coding d3.js library to be used from the browser, using d3-request to get some json files.

I amb testing the parts from node.js using tape, so the different parts can be tested before bundling all the library.

When I use

request.json(url, callback)

The calldoesn0t return the content. Looking the tests at the d3-request library, I see that this require is used:

require("./XMLHttpRequest");

So the library can be used with nodejs, but I can't reproduce it in my library. Also, the docs say that d3-request can be used directly with node (even this tweet by Mike Bostock says so), but I can't find any example.

Does somebody has an example for this?

To make it clearer, when executing:

request.json("sample.json", function(error, json) {
if (error) throw error;
console.info(error, json);
});

The output is undefined undefined

Upvotes: 0

Views: 230

Answers (0)

Related Questions