Break middleware out into separate files

This commit is contained in:
MICHAEL JACKSON
2017-08-10 10:12:50 -07:00
parent 8fdc926bb9
commit 7661950de3
7 changed files with 302 additions and 245 deletions

View File

@ -0,0 +1,14 @@
/**
* Check the blacklist to see if we can serve files from this package.
*/
function checkBlacklist(blacklist) {
return function (req, res, next) {
if (blacklist.includes(req.packageName)) {
res.status(403).send(`Package ${req.packageName} is blacklisted`)
} else {
next()
}
}
}
module.exports = checkBlacklist