Skip to content

Instantly share code, notes, and snippets.

@robdodson
Created October 17, 2012 21:39
Show Gist options
  • Select an option

  • Save robdodson/3908432 to your computer and use it in GitHub Desktop.

Select an option

Save robdodson/3908432 to your computer and use it in GitHub Desktop.
static.js
exports = module.exports = function static(root, options){
options = options || {};
// root required
if (!root) throw new Error('static() root path required');
options.root = root;
return function static(req, res, next) {
console.log('!!! STATIC HIT !!!');
console.log(req.path);
options.path = req.url;
options.getOnly = true;
send(req, res, next, options);
};
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment