node-static icon indicating copy to clipboard operation
node-static copied to clipboard

how to override mime type for some file extensions?

Open futurist opened this issue 9 years ago • 2 comments

want to change some of the file's mime type, is there any api? or just interpolate node response?

futurist avatar Jan 01 '16 01:01 futurist

Currently no.. but PR #184 would allow something like this:

var file = new static.Server('./public');

require('http').createServer(function (request, response) {
    request.addListener('end', function () {
        response.setHeader('Content-Type', 'text/html') // explicitly override content type here
        file.serve(request, response);
    }).resume();
}).listen(8080);

leviwheatcroft avatar Oct 16 '16 00:10 leviwheatcroft

Actually this issue is a dupe of #169

leviwheatcroft avatar Oct 17 '16 09:10 leviwheatcroft