2017-06-28 10:20:22 +02:00
|
|
|
'use strict';
|
|
|
|
|
2018-11-30 10:11:36 +01:00
|
|
|
const Controller = require('../controller');
|
2018-11-30 11:11:12 +01:00
|
|
|
const FeatureController = require('./feature.js');
|
2018-11-30 08:24:22 +01:00
|
|
|
const ArchiveController = require('./archive.js');
|
2018-11-30 10:11:36 +01:00
|
|
|
const EventController = require('./event.js');
|
2017-06-28 10:20:22 +02:00
|
|
|
const strategies = require('./strategy');
|
|
|
|
const metrics = require('./metrics');
|
2017-11-16 16:45:01 +01:00
|
|
|
const user = require('./user');
|
2018-11-29 21:25:45 +01:00
|
|
|
const apiDef = require('./api-def.json');
|
|
|
|
|
2018-11-30 10:11:36 +01:00
|
|
|
class AdminApi extends Controller {
|
2018-11-29 21:25:45 +01:00
|
|
|
constructor(config) {
|
2018-11-30 10:11:36 +01:00
|
|
|
super();
|
|
|
|
|
|
|
|
const stores = config.stores;
|
2018-11-29 21:25:45 +01:00
|
|
|
|
2018-11-30 10:11:36 +01:00
|
|
|
this.app.get('/', this.index);
|
2018-12-03 08:59:13 +01:00
|
|
|
this.app.use('/features', new FeatureController(stores).router);
|
|
|
|
this.app.use('/archive', new ArchiveController(stores).router);
|
2018-11-30 10:11:36 +01:00
|
|
|
this.app.use('/strategies', strategies.router(config));
|
2018-12-03 08:59:13 +01:00
|
|
|
this.app.use('/events', new EventController(stores).router);
|
2018-11-30 10:11:36 +01:00
|
|
|
this.app.use('/metrics', metrics.router(config));
|
|
|
|
this.app.use('/user', user.router(config));
|
2018-11-29 21:25:45 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
index(req, res) {
|
|
|
|
res.json(apiDef);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = AdminApi;
|