Request Validation Middleware

Aim

To implement request validation middleware using Express.js.

Validation

The middleware checks whether the request contains both name and age.

Example Request

{
    "name": "Madhu",
    "age": 20
}
    

Output

Valid user data is accepted and invalid data is rejected.