node.js express - mime type woff font returned as text/plain type

5k views Asked by At

I am using node-mime to set the correct mime type for woff font. Still not working. Any help would be much appreciated.

var express = require('express')
var mime = require('mime');

...

express.static.mime.define({
 'application/x-font-woff': ['woff'],
 'application/font-woff': ['woff']
}); 

Cheers @harishvc

1

There are 1 answers

0
Oliver Salzburg On

You're probably missing a proper route to serve your fonts. serve-static will already provide the correct mime types.

You can easily serve static resources in your project with serve-static. If you're already using serve-static check that you're actually sending the font when it is requested.