2021-03-11 22:51:58 +01:00
|
|
|
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');
|
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');
|
2018-11-24 12:43:46 +01:00
|
|
|
const HealthCheckController = require('./health-check');
|
2020-03-29 22:22:19 +02:00
|
|
|
const LogoutController = require('./logout');
|
2018-11-29 21:25:45 +01:00
|
|
|
const api = require('./api-def');
|
2021-04-09 13:46:53 +02:00
|
|
|
const SimplePasswordProvider = require('./auth/simple-password-provider');
|
2017-06-28 10:20:22 +02:00
|
|
|
|
2018-12-03 08:59:13 +01:00
|
|
|
class IndexRouter extends Controller {
|
2020-12-17 19:43:01 +01:00
|
|
|
constructor(config, services) {
|
2021-03-11 22:51:58 +01:00
|
|
|
super(config);
|
2018-12-03 08:59:13 +01:00
|
|
|
this.use('/health', new HealthCheckController(config).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,
|
|
|
|
);
|
2018-12-03 08:59:13 +01:00
|
|
|
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);
|
2018-11-24 12:58:30 +01:00
|
|
|
}
|
2017-06-28 10:20:22 +02:00
|
|
|
|
2018-12-03 08:59:13 +01:00
|
|
|
index(req, res) {
|
|
|
|
res.json(api);
|
2017-09-07 21:42:21 +02:00
|
|
|
}
|
2018-11-24 12:58:30 +01:00
|
|
|
}
|
2016-11-09 22:31:49 +01:00
|
|
|
|
2018-11-24 12:58:30 +01:00
|
|
|
module.exports = IndexRouter;
|