Доработки контроллера

This commit is contained in:
Book Pauk
2018-12-27 15:16:10 +07:00
parent 2722f3a3fb
commit afbdb17e6d
2 changed files with 8 additions and 5 deletions

View File

@@ -3,9 +3,14 @@ const BaseController = require('./BaseController');
const Lazy = require('lazy.js');
class MiscController extends BaseController {
async configValue(req) {
return Lazy(this.config).pick([req.params.name]).toObject();
async getConfig(req, res) {
if (Array.isArray(req.body.params))
return Lazy(this.config).pick(req.body.params).toObject();
//bad request
res.status(400).send({error: 'params is not an array'});
return false;
}
}
module.exports = MiscController;