serve-waterfall
Serves static files according to a waterfall of URL to file mappings
Last updated 5 years ago by nevir .
BSD-3-Clause · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install serve-waterfall 
SYNC missed versions from official npm registry.

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.

Current Tags

  • 1.1.1                                ...           latest (5 years ago)

3 Versions

  • 1.1.1                                ...           5 years ago
  • 1.1.0                                ...           5 years ago
  • 1.0.0                                ...           5 years ago
Downloads
Today 0
This Week 0
This Month 4
Last Day 0
Last Week 4
Last Month 20
Dependencies (2)
Dev Dependencies (4)

Copyright 2014 - 2016 © taobao.org |