0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-17 23:44:39 -05:00

Moved labs middleware into labs utility

- this middleware isn't used anywhere at the moment
- including it in our labs utility should help to make it moe discoverable
This commit is contained in:
Hannah Wolfe 2021-07-07 21:47:19 +01:00
parent 782de52678
commit 161ba51d2b
No known key found for this signature in database
GPG key ID: 9F8C7532D0A6BA55
2 changed files with 8 additions and 12 deletions

View file

@ -1,12 +0,0 @@
const errors = require('@tryghost/errors');
const labsUtil = require('../../../../shared/labs');
const labs = flag => (req, res, next) => {
if (labsUtil.isSet(flag) === true) {
return next();
} else {
return next(new errors.NotFoundError());
}
};
module.exports = labs;

View file

@ -94,3 +94,11 @@ module.exports.enabledHelper = function enabledHelper(options, callback) {
return errString; return errString;
}; };
module.exports.enabledMiddleware = flag => (req, res, next) => {
if (this.isSet(flag) === true) {
return next();
} else {
return next(new errors.NotFoundError());
}
};