1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-12-22 19:07:54 +01:00

Revert "Remove /api/client/seen-toggles as we don't need it anyway"

This reverts commit 63e6931265.
This commit is contained in:
sveisvei 2016-12-09 20:21:24 +01:00 committed by Ivar Conradi Østhus
parent 52fcfb4a2b
commit 76d642069b

View File

@ -20,6 +20,23 @@ module.exports = function (app, config) {
res.json(seenAppToggles);
});
app.get('/client/seen-apps', (req, res) => {
const seenApps = metrics.getSeenAppsPerToggle();
clientApplicationsStore.getApplications()
.then(toLookup)
.then(metaData => {
Object.keys(seenApps).forEach(key => {
seenApps[key] = seenApps[key].map(entry => {
if (metaData[entry.appName]) {
entry.data = metaData[entry.appName];
}
return entry;
});
});
res.json(seenApps);
});
});
app.get('/client/metrics/feature-toggles', (req, res) => {
res.json(metrics.getTogglesMetrics());
});
@ -91,6 +108,13 @@ module.exports = function (app, config) {
});
});
function toLookup (metaData) {
return metaData.reduce((result, entry) => {
result[entry.appName] = entry;
return result;
}, {});
}
app.get('/client/applications/', (req, res) => {
clientApplicationsStore
.getApplications(req.query)