serve-waterfall

1.1.1 • Public • Published

NPM version Build Status

serve-waterfall

Serves static files according to a waterfall of URL to file mappings.

Each mapping consists of a URL prefix, and a file system path that it should be mapped to. serve-waterfall will attempt each mapping until it finds a file that exists, which it will serve.

TL;DR:

var app = express();
app.use(serveWaterfall(serveWaterfall.mappings.WEB_COMPONENT));

Or, provide your own mappings:

var app = express();
app.use(serveWaterfall([
  {'/components/<basename>': '.'},
  {'/components': 'bower_components'},
  {'/components': '..'},
  {'/': '.'},
]));

options

serveWaterfall accepts a second argument of options:

root: The directory to resolve files paths relative to.

headers: An object of headers to send with each request.

sendOpts: Additional options to pass to send.

Package Sidebar

Install

npm i serve-waterfall

Weekly Downloads

144

Version

1.1.1

License

BSD-3-Clause

Last publish

Collaborators

  • aomarks
  • emarquez
  • sorvell
  • bicknellr
  • usergenic
  • polymer-devs
  • azakus
  • kevinpschaaf
  • justinfagnani
  • nevir