Simplify server config

This commit is contained in:
MICHAEL JACKSON
2017-08-12 10:38:50 -07:00
parent 4653ee9e42
commit 5f2805c2e9
5 changed files with 53 additions and 58 deletions

View File

@ -1,13 +1,13 @@
const blacklist = require('../PackageBlacklist').blacklist
/**
* 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()
}
function checkBlacklist(req, res, next) {
if (blacklist.includes(req.packageName)) {
res.status(403).send(`Package ${req.packageName} is blacklisted`)
} else {
next()
}
}