I have the following Javascript segment:
function setLifts() {
var $lifts = [];
$.ajax({
url: 'data/lifts.csv',
contentType: 'text/csv',
async: false,
success: function(text) {
$lifts = text.split(/\n/);
return;
}
});
return $lifts;
}
I get the following error when I load the page in Chrome: GET http://127.0.0.1:3000/data/lifts.csv 404 (Not Found)
I have a data directory in the root of my Dancer app. What is the correct path to the csv files?
Thanks!
You need to define a route handler to deal with those and have Dancer send the file to the client. See the Dancer doc.
The directory
data
is not included in a standard Dancer installation. You should move the data to public out of security concerns (the doc talks ofreturn send_file('/etc/passwd', system_path => 1);
).Of course stuff in
public
can be downloaded without a route handler. The CSS, JS anddispatch.fcgi
are in there for starters.