static-router
Express/Connect middleware to server static files based on glob-like routes.
Last updated 12 years ago by scottcorgan .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ npm install static-router 
SYNC missed versions from official npm registry.

static-router

Express/Connect middleware to server static files based on glob-like routes.

Install

npm install static-router --save

Usage

var http = require('http');
var connect = require('connect');
var router = require('static-router');

var app = connect();

app.use(router({
  '**': '/index.html'
}));

http.createServer(app).listen(3000, function () {
  
});

Ensure order of routes

var http = require('http');
var connect = require('connect');
var router = require('static-router');

var app = connect();

app.use(router([
  {'/some-route': '/some-file.html'},
  {'**': '/index.html'}
}));

http.createServer(app).listen(3000, function () {
  
});

router(routes[, options])

  • routes - object or array containing globs as keys and target static files and values. Use of an array ensures the order in which the routes are parsed.
  • options
    • root - the root directory of the static files.
    • index - name of the default directory index file. Defaults to index.html.

Run Tests

npm install
npm test

Current Tags

  • 1.1.0                                ...           latest (12 years ago)

13 Versions

  • 1.1.0                                ...           12 years ago
  • 1.0.5                                ...           12 years ago
  • 1.0.4                                ...           12 years ago
  • 1.0.3                                ...           12 years ago
  • 1.0.2                                ...           12 years ago
  • 1.0.1                                ...           12 years ago
  • 1.0.0                                ...           12 years ago
  • 0.3.1                                ...           12 years ago
  • 0.3.0                                ...           12 years ago
  • 0.2.3                                ...           12 years ago
  • 0.2.2                                ...           12 years ago
  • 0.2.1                                ...           12 years ago
  • 0.2.0                                ...           12 years ago
Maintainers (1)
Downloads
Total 30
Today 0
This Week 12
This Month 30
Last Day 0
Last Week 18
Last Month 0
Dependencies (9)
Dev Dependencies (7)
Dependents (1)

© 2010 - cnpmjs.org x YWFE | Home | YWFE