broker

Express/Connect middleware that serves local or remote static files.

Showing:

Popularity

Downloads/wk

21

GitHub Stars

1

Maintenance

Last Commit

7yrs ago

Contributors

0

Package

Dependencies

4

Size (min+gzip)

77.0KB

License

MIT

Type Definitions

Tree-Shakeable

No?

Categories

Readme

broker

Express/Connect middleware that serves local or remote static files.

Install

npm install broker --save

Usage

Serve static files

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

var app = express();

app.use(broker({
  root: '/public'
}));

app.listen(3000, function () {

});

Proxy remote files

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

var app = express();

app.use(broker({
  root: 'http://proxyserver.com'
}));

app.listen(3000, function () {

});

broker([options])

  • options - the options are similar to the send module because it uses this to serve local static files. Here are a few:
    • root - the root directory if serving local files or the url to prepend to requests to proxy remote static files
    • index - a string or array of strings that define the directory index file
    • dotfiles - how to handle files that begin with a dot. These are usually hidden files. The default value is ignore. Available options:
      • allow - No special treatment for dotfiles
      • deny - Send a 403 for any request for a dotfile
      • ignore - Pretend like the dotfile does not exist and 404

Run Tests

npm install
npm test

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100