MiscController.js 524 B

123456789101112131415161718
  1. const BaseController = require('./BaseController');
  2. const _ = require('lodash');
  3. class MiscController extends BaseController {
  4. async getConfig(req, res) {
  5. if (Array.isArray(req.body.params)) {
  6. const paramsSet = new Set(req.body.params);
  7. return _.pick(this.config, this.config.webConfigParams.filter(x => paramsSet.has(x)));
  8. }
  9. //bad request
  10. res.status(400).send({error: 'params is not an array'});
  11. return false;
  12. }
  13. }
  14. module.exports = MiscController;