const action = Object.keys(actions) .map(key => actions[key]) .find(val => val === req.action); if (!action) { logger.error('Invalid action %s', req.action); return res.status(400).send(errors.common.INVALID_ACTION); logger.log('===> %s: %O', req.action, req.body); next(); }); const result = dispatch(store.getState(), req.action, req.body, fullConfig); if (result.err) { return res.status(400).send({ type: req.action, result, });