1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-11-01 19:07:38 +01:00
unleash.unleash/src/lib/routes/index.ts

35 lines
1.2 KiB
TypeScript
Raw Normal View History

import { BackstageController } from './backstage';
2016-06-18 21:53:18 +02:00
2018-11-29 21:25:45 +01:00
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 LogoutController = require('./logout');
2018-11-29 21:25:45 +01:00
const api = require('./api-def');
class IndexRouter extends Controller {
2020-12-17 19:43:01 +01:00
constructor(config, services) {
super(config);
this.use('/health', new HealthCheckController(config).router);
this.use('/internal-backstage', new BackstageController(config).router);
this.use('/logout', new LogoutController(config).router);
this.get(api.uri, this.index);
2020-12-17 19:43:01 +01:00
this.use(api.links.admin.uri, new AdminApi(config, services).router);
this.use(api.links.client.uri, new ClientApi(config, services).router);
// legacy support (remove in 4.x)
if (config.enableLegacyRoutes) {
const featureController = new FeatureController(services, config);
this.use('/api/features', featureController.router);
}
}
index(req, res) {
res.json(api);
}
}
module.exports = IndexRouter;