2021-03-11 22:51:58 +01:00
|
|
|
import { BackstageController } from './backstage';
|
2021-04-16 15:29:23 +02:00
|
|
|
import ResetPasswordController from './auth/reset-password-controller';
|
2022-06-23 09:40:25 +02:00
|
|
|
import { SimplePasswordProvider } from './auth/simple-password-provider';
|
2021-04-22 10:07:10 +02:00
|
|
|
import { IUnleashConfig } from '../types/option';
|
|
|
|
import { IUnleashServices } from '../types/services';
|
2022-06-03 11:50:58 +02:00
|
|
|
import LogoutController from './logout';
|
2016-06-18 21:53:18 +02:00
|
|
|
|
2018-11-29 21:25:45 +01:00
|
|
|
const AdminApi = require('./admin-api');
|
2018-11-24 15:45:22 +01:00
|
|
|
const ClientApi = require('./client-api');
|
2018-12-03 08:59:13 +01:00
|
|
|
const Controller = require('./controller');
|
2022-06-20 12:22:41 +02:00
|
|
|
import { HealthCheckController } from './health-check';
|
2022-08-16 15:33:33 +02:00
|
|
|
import ProxyController from './proxy-api';
|
|
|
|
|
2018-12-03 08:59:13 +01:00
|
|
|
class IndexRouter extends Controller {
|
2021-04-22 10:07:10 +02:00
|
|
|
constructor(config: IUnleashConfig, services: IUnleashServices) {
|
2021-03-11 22:51:58 +01:00
|
|
|
super(config);
|
2021-04-22 10:07:10 +02:00
|
|
|
this.use('/health', new HealthCheckController(config, services).router);
|
2021-02-16 14:30:08 +01:00
|
|
|
this.use('/internal-backstage', new BackstageController(config).router);
|
2020-03-29 22:22:19 +02:00
|
|
|
this.use('/logout', new LogoutController(config).router);
|
2021-04-09 13:46:53 +02:00
|
|
|
this.use(
|
|
|
|
'/auth/simple',
|
|
|
|
new SimplePasswordProvider(config, services).router,
|
|
|
|
);
|
2021-04-16 15:29:23 +02:00
|
|
|
this.use(
|
|
|
|
'/auth/reset',
|
|
|
|
new ResetPasswordController(config, services).router,
|
|
|
|
);
|
2022-08-16 15:33:33 +02:00
|
|
|
this.use('/api/admin', new AdminApi(config, services).router);
|
|
|
|
this.use('/api/client', new ClientApi(config, services).router);
|
2017-06-28 10:20:22 +02:00
|
|
|
|
2022-08-26 08:22:42 +02:00
|
|
|
if (config.experimental.flags.embedProxy) {
|
2022-08-16 15:33:33 +02:00
|
|
|
this.use(
|
|
|
|
'/api/frontend',
|
|
|
|
new ProxyController(config, services).router,
|
|
|
|
);
|
|
|
|
}
|
2017-09-07 21:42:21 +02:00
|
|
|
}
|
2018-11-24 12:58:30 +01:00
|
|
|
}
|
2016-11-09 22:31:49 +01:00
|
|
|
|
2021-04-22 10:07:10 +02:00
|
|
|
export default IndexRouter;
|
|
|
|
|
2018-11-24 12:58:30 +01:00
|
|
|
module.exports = IndexRouter;
|