function requireBody(paramsList) {
  return function (req, res, next) {
    var errors = [];
    var status = 'ok';

    for (var i = 0; i < paramsList.length; i++) {
      var val = req.body[paramsList[i]];

      if (!val) {
        errors.push(`required parameter \`${paramsList[i]}\` not found.`);
        status = 'error';
      }
    }

    if (errors.length === 0) {
      next();
    } else {
      return res.status(400).json({
        errors: errors,
        status: status
      });
    }
  };
}