mirror of
https://github.com/Unleash/unleash.git
synced 2025-01-31 00:16:47 +01:00
chore(modernize): Modernize BackstageController
This commit is contained in:
parent
7bc8ed0334
commit
6a36f71a98
@ -3,7 +3,8 @@
|
||||
const { Router } = require('express');
|
||||
const { register: prometheusRegister } = require('prom-client');
|
||||
|
||||
exports.router = config => {
|
||||
class BackstageController {
|
||||
constructor(config) {
|
||||
const router = Router();
|
||||
|
||||
if (config.serverMetrics) {
|
||||
@ -13,5 +14,12 @@ exports.router = config => {
|
||||
});
|
||||
}
|
||||
|
||||
return router;
|
||||
};
|
||||
this.app = router;
|
||||
}
|
||||
|
||||
router() {
|
||||
return this.app;
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = BackstageController;
|
||||
|
@ -11,13 +11,13 @@ const clientApi = require('./client-api');
|
||||
const clientFeatures = require('./client-api/feature.js');
|
||||
|
||||
const HealthCheckController = require('./health-check');
|
||||
const backstage = require('./backstage.js');
|
||||
const BackstageController = require('./backstage.js');
|
||||
|
||||
exports.router = function(config) {
|
||||
const router = Router();
|
||||
|
||||
router.use('/health', new HealthCheckController(config).router());
|
||||
router.use('/internal-backstage', backstage.router(config));
|
||||
router.use('/internal-backstage', new BackstageController(config).router());
|
||||
|
||||
router.get('/api', (req, res) => {
|
||||
res.json({
|
||||
|
Loading…
Reference in New Issue
Block a user