Joi.validate code example
Example 1: joi object id validation
npm i joi-objectid
const Joi = require('joi');
Joi.objectId = require('joi-objectid')(Joi)
// now you can use Joi.objectId to validate the post request sent by user
Example 2: joi regex validate
Joi.string().regex(/^[a-zA-Z0-9_][a-zA-Z0-9_.]*/)