function onRequest(req, res) {
if (req.body.widget_name) {
console.log(req.body.widget_name);
}
var fs = require('fs');
var data = fs.readdir("corpdashboard/dashboards", 'UTF-8', function (err, files) {
if (err) {
return console.log(err);
}
console.log(data);
});
var body = req.body.dashboard_selected + ' ' + req.body.widget_selected + ' ';
res.setHeader('Content-Type', 'text/plain');
res.setHeader('Content-Length', body.length);
res.end(body);
}
exports.onrequest = onRequest;
I want to read directories and the file in that so I write this code and run it. on running i am getting that fs:missing callback function :ENOENT readdir 'D:\dev\corpdashboboard\dashboard.js' 'D:\dev\corpdashboboard' is the where i have my ejs file and js file what does it means? what should I do to read directories and files in them