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

34 lines
1.1 KiB
JavaScript

'use strict';
const AdminApi = require('./admin-api');
const ClientApi = require('./client-api');
const FeatureController = require('./client-api/feature.js');
const Controller = require('./controller');
const HealthCheckController = require('./health-check');
const BackstageCTR = require('./backstage.js');
const api = require('./api-def');
class IndexRouter extends Controller {
constructor(config) {
super();
this.use('/health', new HealthCheckController(config).router);
this.use('/internal-backstage', new BackstageCTR(config).router);
this.get(api.uri, this.index);
this.use(api.links.admin.uri, new AdminApi(config).router);
this.use(api.links.client.uri, new ClientApi(config).router);
// legacy support (remove in 4.x)
if (config.enableLegacyRoutes) {
const featureController = new FeatureController(config.stores);
this.use('/api/features', featureController.router);
}
}
index(req, res) {
res.json(api);
}
}
module.exports = IndexRouter;