Reputation: 57
I am trying to use d3.js example code here: https://bl.ocks.org/ChumaA/385a269db46ae56444772b62f1ae82bf
In this case I am using view jade/express/node to load it, however I am getting a 404 error for the mockelasticdata.json file, I believe I am routing it correctly. I provided photos to show the directory path and the chrome console error.
Console Error:
Directory Path:
edit: here is the json call using d3 to read the data
d3.json('src/mockelasticdata.json', function(error, mockdata) {
if (error) return console.error(error);
console.log('mockdata',mockdata);
mapdata = mockdata;
draw(mockdata)
});
Upvotes: 2
Views: 3344
Reputation: 4930
You're trying to access a file in the src directory. After your project is built and run, that directory doesn't exist.
Move the JSON file into the public directory. This is where all static, unrouted files will be served from.
Upvotes: 3