Answer the question
In order to leave comments, you need to log in
How to do link validation in celebrate?
Hello! Can anyone tell me how links are validated in the celebrate method? Only through regular expressions? For email, Joi has an email() method, but not for links. Maybe I don't know something?) How can I do the validation here, without a regular expression?
app.post('/signup', celebrate({
body: Joi.object().keys({
link: Joi.string().required().pattern(/(https?:\/\/)(w{3}\.)?(((\d{1,3}\.){3}\d{1,3})|((\w-?)+\.(ru|com)))(:\d{2,5})?((\/.+)+)?\/?#?/)
})
}));
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question