Ghost/core/server/web/shared/middlewares/labs.js
Fabien O'Carroll 235d6a0366 Refactored labs middleware to remove duplication
no-issue

Also exposes a generic interface now.
2019-04-24 12:46:00 +02:00

16 lines
382 B
JavaScript

const labsUtil = require('../../../services/labs');
const common = require('../../../lib/common');
const labs = flag => (req, res, next) => {
if (labsUtil.isSet(flag) === true) {
return next();
} else {
return next(new common.errors.NotFoundError());
}
};
labs.subscribers = labs('subscribers');
labs.members = labs('members');
module.exports = labs;