Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/2do2go/dummy-static-middleware
Dummy static middleware for expressjs
https://github.com/2do2go/dummy-static-middleware
Last synced: 29 days ago
JSON representation
Dummy static middleware for expressjs
- Host: GitHub
- URL: https://github.com/2do2go/dummy-static-middleware
- Owner: 2do2go
- Created: 2013-04-22T08:25:24.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2013-04-22T13:20:07.000Z (over 11 years ago)
- Last Synced: 2024-11-08T08:18:34.277Z (2 months ago)
- Language: JavaScript
- Homepage:
- Size: 102 KB
- Stars: 1
- Watchers: 5
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Dummy static middleware for expressjs
which prevents annoying 'not found' errors at development environment.
## Installation
```bash
npm install dummy-static-middleware
```
## Usage
```js
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.