Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Branch: master
Fetching contributors…

Cannot retrieve contributors at this time

27 lines (16 sloc) 0.545 kB

Dummy static middleware for expressjs

which prevents annoying 'not found' errors at development environment.

Installation

npm install dummy-static-middleware

Usage

app.use(express.static('static/'));
app.use(require('dummy-static-middleware')([
    {url: /\.(jpeg|jpg|JPG|png|gif)$/, reply: 'static/images/dummy404.png'},
    {url: '/some.txt', reply: 'static/dummy.txt'}
]));

url could be regular expression or string for exact matching, reply is path to file which content will be sent in the response.

Jump to Line
Something went wrong with that request. Please try again.