mirror of
https://github.com/Unleash/unleash.git
synced 2025-01-01 00:08:27 +01:00
28 lines
589 B
JavaScript
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;
|