1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-12-28 00:06:53 +01:00
unleash.unleash/lib/routes/client-api/index.js

33 lines
836 B
JavaScript
Raw Normal View History

'use strict';
const Controller = require('../controller');
const FeatureController = require('./feature.js');
const MetricsController = require('./metrics.js');
const RegisterController = require('./register.js');
2018-11-29 21:25:45 +01:00
const apiDef = require('./api-def.json');
class ClientApi extends Controller {
constructor(config, services = {}) {
super();
const { getLogger } = config;
this.get('/', this.index);
this.use(
'/features',
new FeatureController(services, getLogger).router,
);
this.use('/metrics', new MetricsController(services, getLogger).router);
this.use(
'/register',
new RegisterController(services, getLogger).router,
);
}
index(req, res) {
2018-11-29 21:25:45 +01:00
res.json(apiDef);
}
}
module.exports = ClientApi;