Tuesday, 17 September 2013

How do I make every file in a static dir have Content-Type ... using express?

How do I make every file in a static dir have Content-Type ... using express?

I have a dir that contains anywhere between zero and a few hundre files,
all without extension (generated in an unknowable nested dir structure by
another app, with the writing occurring somewhere in a library that I
can't, nor want, to modify code in), with all files containing html
content. I'd like to use express's convenient static call so I don't have
to worry about which files exist, but
app.use(express.static("..."))
does not let me say that all the content from this dir should be
Content-Type text/html. Is there a way to to serve up content from
anywhere in that dir (without knowing what's in it) with the response
header always saying the content is text/html?

No comments:

Post a Comment