最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - TypeError Joi.validate is not a function - Stack Overflow

programmeradmin3浏览0评论

please help with that i am not sure what is happening im using the following:

"body-parser": "1.19.0",
"express": "4.17.1",
"joi": "17.1.1"

but it is only the joi that im having issues with

please help with that i am not sure what is happening im using the following:

"body-parser": "1.19.0",
"express": "4.17.1",
"joi": "17.1.1"

but it is only the joi that im having issues with

Share Improve this question edited Jul 23, 2020 at 12:08 AleksanderGD 4085 silver badges11 bronze badges asked Jul 23, 2020 at 12:02 Xx_RoboMan69Xx_RoboMan69 351 silver badge4 bronze badges
Add a ment  | 

3 Answers 3

Reset to default 8

Try schema.validate instead of Joi.validate

Reference: https://joi.dev/api#example

Joi changed in implementation. You should be validating the schema against your request body. It should be something like schema.validate(req.body, (err, result) => {} .....)

Did you do :

const Joi = require('joi')   

at beginning of this file? Notice the capital J.

发布评论

评论列表(0)

  1. 暂无评论