User Input Validation with express and JOI part 2 | Nodejs full course | #revildo_code

preview_player
Показать описание
User Input Validation with express and JOI part 2 | Nodejs full course | Full tutorial for beginners | #revildo_code

Steps to implement API Request Schema with Joi Validation In Node. js and Express.

Initial Setup. ...

Install dependencies. ...

Create Server and Connect with Database. ...

Creating Connection file. ...

Creating server file. ...

Creating Home Route. ...

Creating controller.

How To Use Joi for Node API Schema Validation

Create validation schema for the request data parameters.

Handle validation errors and give appropriate feedback.

Create a middleware to intercept and validate requests.

Joi can be used for creating schemas (just like we use mongoose for creating NoSQL schemas) and you can use it with plain Javascript objects. It's like a plug n play library and is easy to use. On the other hand, express-validator uses validator. js to validate expressjs routes, and it's mainly built for express.

Roadmap

Create login , register , post joi schemas.

Export all schemas as single

Create configurable middleware that takes
schema name as parameter and validates

Create auth and post routes.

Create expressjs instance.

Joi JS: Joi - awesome code validation for Node. js and Express - DEV Community

Рекомендации по теме
join shbcf.ru