node package manager
We need your input. Help make JavaScript better: Take the 2017 JavaScript Ecosystem survey »


This is a middleware to send files with a user-defined mime type.


The express-custom-mime-types package is simply a function, which accepts one parameter: options.

So far, options accepts one property: mimes. mimes is an associative array.

Each property of the associative array represents the file extension with the value being the mime-type.

In the following example, we have our express.js app serve *.underscore files as plain text.

var express = require('express');
var app = express();
app.configure(function () {
  // ... 
    mimes: {
      '.underscore': 'text/plain'
  // ...