Skip to content

How to customise response MIME types

Lloyd Brookes edited this page Jun 23, 2019 · 5 revisions

This middleware enables you to override the default mime-type returned with any static resource served.

To override the default mappings, set a mime property in the config. The mime value should be a plain object containing a key for each MIME type you wish to override. The value of each key is a list of file extensions to apply the MIME type to. This value is passed directly to mime.define(). Example:

module.exports = {
  mime: {
    'text/plain': [ 'php', 'pl' ]
  }
}
Clone this wiki locally