Created
March 4, 2015 20:40
-
-
Save hayes/b0084ea39052d294a414 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
www(null, '', 'nrnpm') | |
unpm.middleware.push(docs) | |
unpm.server.listen(instance.port) | |
function docs(respond, matched, unpm, next) { | |
var headers = respond.req.headers | |
var route | |
var acceptable = headers.accept && headers.accept.match(/image|(text\/(?:html|css))/) | |
var tarball = respond.req.url.match(/\.tgz$/i) | |
if (acceptable && !tarball) { | |
route = www.router.match(respond.req.method, respond.req.url) | |
} | |
if (!route) return next() | |
route.fn(respond.req, respond.res, route, www.config) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment