webserver/controllers/search/search-local.js
/**
 * Validate if search data is valid
 * @param {Object} payload Object to be validated. { q: String to search }
 * @return {Object} null if data is valid, throw an Error if data is not valid
 */
Validate if search data is valid
@param {Object} payload Object to be validated. { q: String to search }
@return {Object} null if data is valid, throw an Error if data is not valid
Validate if search data is valid @param { Object } payload Object to be validated . { q : String to search } @return { Object } null if data is valid throw an Error if data is not valid
async function validate(payload) {
  const schema = {
    q: Joi.string()
      .min(3)
      .max(128)
      .required()
  };
  return Joi.validate(payload, schema);
}
async function validate ( payload ) { const schema = { q : Joi . string ( ) . min ( 3 ) . max ( 128 ) . required ( ) } ; return Joi . validate ( payload , schema ) ; }
Validate if search data is valid
 @param {Object} payload Object to be validated.
Validate if search data is valid @param { Object } payload Object to be validated .