How can I read files from directory and send as JSON to client?
You have to put serialize the Logs
array into json and send it back to client
app.get('/logs',function(req,res){
res.setHeader('Content-Type', 'application/json');
res.send(JSON.stringify(readDirectory.readDirectory()));
});
Or
app.get('/logs',function(req,res){
res.json(readDirectory.readDirectory());
});