2017-06-28 10:20:22 +02:00
|
|
|
'use strict';
|
|
|
|
|
2018-12-03 08:59:13 +01:00
|
|
|
const Controller = require('../controller');
|
2018-11-24 15:02:31 +01:00
|
|
|
const FeatureController = require('./feature.js');
|
2018-11-29 20:46:24 +01:00
|
|
|
const MetricsController = require('./metrics.js');
|
|
|
|
const RegisterController = require('./register.js');
|
2018-11-29 21:25:45 +01:00
|
|
|
const apiDef = require('./api-def.json');
|
2017-06-28 10:20:22 +02:00
|
|
|
|
2018-12-03 08:59:13 +01:00
|
|
|
class ClientApi extends Controller {
|
2021-01-18 12:32:19 +01:00
|
|
|
constructor(config, services = {}) {
|
2018-12-03 08:59:13 +01:00
|
|
|
super();
|
2017-06-28 10:20:22 +02:00
|
|
|
|
2020-04-14 22:29:11 +02:00
|
|
|
const { getLogger } = config;
|
2018-11-29 21:01:53 +01:00
|
|
|
|
2018-12-03 08:59:13 +01:00
|
|
|
this.get('/', this.index);
|
2021-01-18 12:32:19 +01:00
|
|
|
this.use(
|
|
|
|
'/features',
|
|
|
|
new FeatureController(services, getLogger).router,
|
|
|
|
);
|
|
|
|
this.use('/metrics', new MetricsController(services, getLogger).router);
|
|
|
|
this.use(
|
|
|
|
'/register',
|
|
|
|
new RegisterController(services, getLogger).router,
|
|
|
|
);
|
2018-11-24 15:45:22 +01:00
|
|
|
}
|
2017-06-28 10:20:22 +02:00
|
|
|
|
2018-11-24 15:45:22 +01:00
|
|
|
index(req, res) {
|
2018-11-29 21:25:45 +01:00
|
|
|
res.json(apiDef);
|
2018-11-24 15:45:22 +01:00
|
|
|
}
|
|
|
|
}
|
2017-06-28 10:20:22 +02:00
|
|
|
|
2018-11-24 15:45:22 +01:00
|
|
|
module.exports = ClientApi;
|