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
|
|
|
|
2018-11-29 21:01:53 +01:00
|
|
|
const stores = config.stores;
|
|
|
|
|
2018-12-03 08:59:13 +01:00
|
|
|
this.get('/', this.index);
|
|
|
|
this.use('/features', new FeatureController(stores).router);
|
|
|
|
this.use('/metrics', new MetricsController(stores).router);
|
|
|
|
this.use('/register', new RegisterController(stores).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;
|