static

lib/middleware/static.js

Static file server with the given root path.

Examples

var oneDay = 86400000;

connect(
  connect.static(__dirname + '/public')
).listen(3000);

connect(
  connect.static(__dirname + '/public', { maxAge: oneDay })
).listen(3000);

Options

  • maxAge Browser cache maxAge in milliseconds. defaults to 0
  • hidden Allow transfer of hidden files. defaults to false
  • redirect Redirect to trailing "/" when the pathname is a dir