1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-12-28 00:06:53 +01:00
unleash.unleash/lib/routes/admin-api/context.js
2020-02-20 08:34:30 +01:00

28 lines
589 B
JavaScript

'use strict';
const Controller = require('../controller');
const builtInContextFields = [
{ name: 'environment' },
{ name: 'userId' },
{ name: 'appName' },
];
class ContextController extends Controller {
constructor(config) {
super(config);
this.contextFields = builtInContextFields.concat(
config.customContextFields
);
this.get('/', this.getContextFields);
}
getContextFields(req, res) {
res.status(200)
.json(this.contextFields)
.end();
}
}
module.exports = ContextController;