diff --git a/lib/routes/feature.js b/lib/routes/feature.js index 458ee98d1d..356c846364 100644 --- a/lib/routes/feature.js +++ b/lib/routes/feature.js @@ -99,6 +99,23 @@ module.exports = function (app, config) { .catch(error => handleErrors(req, res, error)); }); + app.put('/features/:featureName/toggle', (req, res) => { + const featureName = req.params.featureName; + const userName = extractUser(req); + + featureToggleStore.getFeature(featureName) + .then((feature) => { + feature.enabled = !feature.enabled; + return eventStore.store({ + type: FEATURE_UPDATED, + createdBy: userName, + data: feature, + }); + }) + .then(() => res.status(200).end()) + .catch(error => handleErrors(req, res, error)); + }); + app.delete('/features/:featureName', (req, res) => { const featureName = req.params.featureName; const userName = extractUser(req);