Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

celebrate node js

router.post('/',userMiddleWare, (req, res) => {});

const { celebrate, Joi, errors, Segments } = require("celebrate");
const userMiddleware = celebrate({
  body: Joi.object().keys({
    firstName: Joi.string().trim().min(2).max(30).required(),
    lastName: Joi.string().trim().min(2).max(30).required(),
    email: Joi.string()
      .trim()
      .min(2)
      .max(30)
      .required()
      .pattern(new RegExp(/^w+([.-]?w+)*@w+([.-]?w+)*(.w{2,3})+$/)),
    password: Joi.string()
      .trim()
      .min(2)
      .max(30)
      .required()
      .pattern(
        new RegExp("^(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[^A-Za-z0-9_])")
      ),
    role_id: Joi.string().trim().required(),
    position_id: Joi.string().trim().required(),
  }),
});

module.exports = { userMiddleware };
Comment

PREVIOUS NEXT
Code Example
Javascript :: reduce to calculate sum react 
Javascript :: javascript Example 1: Regular Expressions 
Javascript :: how to get location javascript 
Javascript :: why array.map returns undefined 
Javascript :: expresiones ternarias javascript 
Javascript :: js any 
Javascript :: angular get class list for element 
Javascript :: how to use iframe for youtube video in react 
Javascript :: arrow functions in js 
Javascript :: add event listener to all a tags 
Javascript :: gltfjsx 
Javascript :: does pycharm support javascript 
Javascript :: javascript float precision 2 
Javascript :: lenght validation using jquey valisaton 
Javascript :: merge 2 arrays jquery 
Javascript :: use localstorage hook 
Javascript :: jquery function return 
Javascript :: javascript list class properties 
Javascript :: how to check if json data is received in ajax response 
Javascript :: axios npm 
Javascript :: js base64 encode 
Javascript :: split and convert a string into object 
Javascript :: trim string 
Javascript :: convert % to px javascript 
Javascript :: how to use json stringify in javascript 
Javascript :: vscode add shortcut to run in terminal 
Javascript :: js overflowx 
Javascript :: create bottom navigation bar react native 
Javascript :: append javascript example 
Javascript :: javascript add to home screen button 
ADD CONTENT
Topic
Content
Source link
Name
9+8 =