1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-10-18 20:09:08 +02:00
unleash.unleash/src/lib/routes/admin-api/index.ts

98 lines
3.4 KiB
TypeScript
Raw Normal View History

import apiDef from './api-def.json';
import Controller from '../controller';
import { IUnleashServices } from '../../types/services';
import { IUnleashConfig } from '../../types/option';
import FeatureController from './feature';
import FeatureTypeController from './feature-type';
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';
import BootstrapController from './bootstrap-controller';
import StateController from './state';
import TagController from './tag';
import TagTypeController from './tag-type';
import AddonController from './addon';
import ApiTokenController from './api-token-controller';
import UserAdminController from './user-admin';
import EmailController from './email';
import UserFeedbackController from './user-feedback-controller';
import ProjectApi from './project';
import { EnvironmentsController } from './environments-controller';
2018-11-29 21:25:45 +01:00
class AdminApi extends Controller {
constructor(config: IUnleashConfig, services: IUnleashServices) {
super(config);
2018-11-29 21:25:45 +01:00
this.app.get('/', this.index);
2020-12-17 19:43:01 +01:00
this.app.use(
'/features',
new FeatureController(config, services).router,
);
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,
);
this.app.use('/user', new UserController(config, services).router);
this.app.use(
'/ui-config',
new ConfigController(config, services).router,
);
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-12-17 19:43:01 +01:00
this.app.use('/state', new StateController(config, services).router);
this.app.use('/tags', new TagController(config, services).router);
this.app.use(
'/tag-types',
new TagTypeController(config, services).router,
);
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,
);
this.app.use('/email', new EmailController(config, services).router);
this.app.use(
'/user-admin',
new UserAdminController(config, services).router,
);
this.app.use(
'/feedback',
new UserFeedbackController(config, services).router,
);
this.app.use('/projects', new ProjectApi(config, services).router);
this.app.use(
'/environments',
new EnvironmentsController(config, services).router,
);
2018-11-29 21:25:45 +01:00
}
index(req, res) {
res.json(apiDef);
}
}
module.exports = AdminApi;