Reputation: 932
I need to view a doc/txt/enc file from my server but whenever I enter its url in my browser it automatically downloads the file. I just want to view it using a content-type: text/plain; charset=utf-8
Like this one
Edit: I want it to look like this:
Upvotes: 0
Views: 458
Reputation: 10384
Following what's said in the comments, you can change the code that serves statically your folder:
app.use('/public', express.static('public', {
setHeaders: (res, path) => {
if (path.endsWith('.enc')) {
res.type('application/json');
}
}
}));
Upvotes: 1