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 {
|
2018-11-24 15:45:22 +01:00
|
|
|
constructor(config) {
|
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 { stores } = config;
|
|
|
|
const { getLogger } = config;
|
2018-11-29 21:01:53 +01:00
|
|
|
|
2018-12-03 08:59:13 +01:00
|
|
|
this.get('/', this.index);
|
2019-04-30 21:14:23 +02:00
|
|
|
this.use('/features', new FeatureController(stores, getLogger).router);
|
|
|
|
this.use('/metrics', new MetricsController(stores, getLogger).router);
|
|
|
|
this.use('/register', new RegisterController(stores, 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;
|