I'm trying to serve a PDF via Express in a way it is displayed in browser:
app.post('/asset', function(request, response){
var tempFile="/home/applmgr/Desktop/123456.pdf";
fs.readFile(tempFile, function (err,data){
response.contentType("application/pdf");
response.send(data);
});
});
However, the browser shows binary content. How to handle this correctly?