Bummer! This is just a preview. You need to be signed in with an account to view the entire instruction.

Well done!

You have completed REST API Validation with Express!

Instruction

Return Validation Error Messages

If the errors array contains any elements (indicating that one of our validation rules failed) let's return a response with a 400 Bad Request HTTP status code along with the errors. In route.js, add the if statement shown below to the POST /api/users route handler: // Validate that we have a `name` value. if (!user.name) { ... } // Validate that we have an `email` value. if (!user.email) {...