2021-04-22 10:07:10 +02:00
|
|
|
import apiDef from './api-def.json';
|
|
|
|
import Controller from '../controller';
|
|
|
|
import { IUnleashServices } from '../../types/services';
|
|
|
|
import { IUnleashConfig } from '../../types/option';
|
|
|
|
import FeatureController from './feature';
|
2022-06-09 13:17:13 +02:00
|
|
|
import { FeatureTypeController } from './feature-type';
|
2021-04-22 10:07:10 +02:00
|
|
|
import ArchiveController from './archive';
|
|
|
|
import StrategyController from './strategy';
|
|
|
|
import EventController from './event';
|
|
|
|
import MetricsController from './metrics';
|
|
|
|
import UserController from './user';
|
|
|
|
import ConfigController from './config';
|
|
|
|
import ContextController from './context';
|
2021-10-08 10:09:22 +02:00
|
|
|
import ClientMetricsController from './client-metrics';
|
2022-06-10 10:04:56 +02:00
|
|
|
import BootstrapController from './bootstrap';
|
2021-04-22 10:07:10 +02:00
|
|
|
import StateController from './state';
|
|
|
|
import TagController from './tag';
|
|
|
|
import TagTypeController from './tag-type';
|
|
|
|
import AddonController from './addon';
|
2022-06-10 10:04:56 +02:00
|
|
|
import ApiTokenController from './api-token';
|
2021-04-22 10:07:10 +02:00
|
|
|
import UserAdminController from './user-admin';
|
|
|
|
import EmailController from './email';
|
2022-06-10 10:04:56 +02:00
|
|
|
import UserFeedbackController from './user-feedback';
|
|
|
|
import UserSplashController from './user-splash';
|
2021-07-07 10:46:50 +02:00
|
|
|
import ProjectApi from './project';
|
2022-06-10 10:04:56 +02:00
|
|
|
import { EnvironmentsController } from './environments';
|
2022-03-29 14:59:14 +02:00
|
|
|
import ConstraintsController from './constraints';
|
2018-11-29 21:25:45 +01:00
|
|
|
|
2018-11-30 10:11:36 +01:00
|
|
|
class AdminApi extends Controller {
|
2021-04-22 10:07:10 +02:00
|
|
|
constructor(config: IUnleashConfig, services: IUnleashServices) {
|
2018-12-19 14:50:01 +01:00
|
|
|
super(config);
|
2018-11-29 21:25:45 +01:00
|
|
|
|
2018-11-30 10:11:36 +01:00
|
|
|
this.app.get('/', this.index);
|
2022-01-13 11:14:17 +01:00
|
|
|
|
2022-01-14 11:16:17 +01:00
|
|
|
this.app.use(
|
|
|
|
'/features',
|
|
|
|
new FeatureController(config, services).router,
|
|
|
|
);
|
2022-01-13 11:14:17 +01:00
|
|
|
|
2020-08-06 11:18:52 +02:00
|
|
|
this.app.use(
|
|
|
|
'/feature-types',
|
2020-12-17 19:43:01 +01:00
|
|
|
new FeatureTypeController(config, services).router,
|
|
|
|
);
|
|
|
|
this.app.use(
|
|
|
|
'/archive',
|
|
|
|
new ArchiveController(config, services).router,
|
|
|
|
);
|
|
|
|
this.app.use(
|
|
|
|
'/strategies',
|
|
|
|
new StrategyController(config, services).router,
|
|
|
|
);
|
|
|
|
this.app.use('/events', new EventController(config, services).router);
|
|
|
|
this.app.use(
|
|
|
|
'/metrics',
|
|
|
|
new MetricsController(config, services).router,
|
|
|
|
);
|
2021-10-08 10:09:22 +02:00
|
|
|
this.app.use(
|
|
|
|
'/client-metrics',
|
|
|
|
new ClientMetricsController(config, services).router,
|
|
|
|
);
|
2020-12-17 19:43:01 +01:00
|
|
|
this.app.use('/user', new UserController(config, services).router);
|
|
|
|
this.app.use(
|
|
|
|
'/ui-config',
|
|
|
|
new ConfigController(config, services).router,
|
|
|
|
);
|
2021-04-20 12:32:02 +02:00
|
|
|
this.app.use(
|
|
|
|
'/ui-bootstrap',
|
|
|
|
new BootstrapController(config, services).router,
|
|
|
|
);
|
2020-12-17 19:43:01 +01:00
|
|
|
this.app.use(
|
|
|
|
'/context',
|
|
|
|
new ContextController(config, services).router,
|
2020-08-06 11:18:52 +02:00
|
|
|
);
|
2020-12-17 19:43:01 +01:00
|
|
|
this.app.use('/state', new StateController(config, services).router);
|
2021-01-04 10:29:33 +01:00
|
|
|
this.app.use('/tags', new TagController(config, services).router);
|
|
|
|
this.app.use(
|
|
|
|
'/tag-types',
|
|
|
|
new TagTypeController(config, services).router,
|
|
|
|
);
|
2021-01-19 10:42:45 +01:00
|
|
|
this.app.use('/addons', new AddonController(config, services).router);
|
2021-03-29 19:58:11 +02:00
|
|
|
this.app.use(
|
|
|
|
'/api-tokens',
|
|
|
|
new ApiTokenController(config, services).router,
|
|
|
|
);
|
2021-04-09 11:16:06 +02:00
|
|
|
this.app.use('/email', new EmailController(config, services).router);
|
2021-04-09 13:46:53 +02:00
|
|
|
this.app.use(
|
|
|
|
'/user-admin',
|
|
|
|
new UserAdminController(config, services).router,
|
|
|
|
);
|
2021-06-07 11:11:42 +02:00
|
|
|
this.app.use(
|
|
|
|
'/feedback',
|
|
|
|
new UserFeedbackController(config, services).router,
|
|
|
|
);
|
2021-07-07 10:46:50 +02:00
|
|
|
this.app.use('/projects', new ProjectApi(config, services).router);
|
|
|
|
this.app.use(
|
|
|
|
'/environments',
|
|
|
|
new EnvironmentsController(config, services).router,
|
|
|
|
);
|
2021-11-09 20:39:13 +01:00
|
|
|
this.app.use(
|
|
|
|
'/splash',
|
|
|
|
new UserSplashController(config, services).router,
|
|
|
|
);
|
2022-03-29 14:59:14 +02:00
|
|
|
this.app.use(
|
|
|
|
'/constraints',
|
|
|
|
new ConstraintsController(config, services).router,
|
|
|
|
);
|
2018-11-29 21:25:45 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
index(req, res) {
|
|
|
|
res.json(apiDef);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = AdminApi;
|