diff --git a/server/controllers/MiscController.js b/server/controllers/MiscController.js index 2c5035b7..7245d246 100644 --- a/server/controllers/MiscController.js +++ b/server/controllers/MiscController.js @@ -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; diff --git a/server/routes.js b/server/routes.js index 6f8b5f02..099ad1b1 100644 --- a/server/routes.js +++ b/server/routes.js @@ -5,9 +5,7 @@ function initRoutes(app, connPool, config) { const misc = new c.MiscController(connPool, config); const routes = [ - ['POST', '/api/config/:name', misc, 'configValue', {}], - - ['GET', '/api/config/:name', misc, 'configValue', {}], + ['POST', '/api/config', misc, 'getConfig', {}], ]; for (route of routes) {