Combine parse + blacklist middleware

This commit is contained in:
MICHAEL JACKSON
2017-08-16 14:55:40 -07:00
parent ce493823d3
commit b6b477e096
3 changed files with 9 additions and 20 deletions

View File

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