2017-06-28 10:20:22 +02:00
|
|
|
'use strict';
|
|
|
|
|
|
|
|
const { Router } = require('express');
|
|
|
|
|
|
|
|
const features = require('./feature.js');
|
|
|
|
const featureArchive = require('./archive.js');
|
|
|
|
const events = require('./event.js');
|
|
|
|
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');
|
|
|
|
|
|
|
|
class AdminApi {
|
|
|
|
constructor(config) {
|
|
|
|
const router = Router();
|
|
|
|
this._router = router;
|
|
|
|
|
|
|
|
router.get('/', (req, res) => res.json(apiDef));
|
|
|
|
router.use('/features', features.router(config));
|
|
|
|
router.use('/archive', featureArchive.router(config));
|
|
|
|
router.use('/strategies', strategies.router(config));
|
|
|
|
router.use('/events', events.router(config));
|
|
|
|
router.use('/metrics', metrics.router(config));
|
|
|
|
router.use('/user', user.router(config));
|
|
|
|
}
|
|
|
|
|
|
|
|
index(req, res) {
|
|
|
|
res.json(apiDef);
|
|
|
|
}
|
|
|
|
|
|
|
|
router() {
|
|
|
|
return this._router;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = AdminApi;
|