I used Joi validation and it worked perfectly the last time I worked on the project. The next video had a middleware made from it and nothing works after that. I even reverted back to my previous code and it still doesnt work.
First while using the middleware i got an error saying 'cannot read properties of undefined reading('validate')' at my validateCampground function.
Then I made some changes to the code and it said that " 'campground' is required" .
Now, even when all of the inputs pass the validation, it still shows the above error.
I remove the validateCampground middleware, everything works fine. I even checked the documentation and couldnt find the problem anywhere.
I used Joi validation and it worked perfectly the last time I worked on the project. The next video had a middleware made from it and nothing works after that. I even reverted back to my previous code and it still doesnt work.
First while using the middleware i got an error saying 'cannot read properties of undefined reading('validate')' at my validateCampground function.
Then I made some changes to the code and it said that " 'campground' is required" .
Now, even when all of the inputs pass the validation, it still shows the above error.
I remove the validateCampground middleware, everything works fine. I even checked the documentation and couldnt find the problem anywhere.