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!
You have completed REST API Validation with Express!
Instruction
Next Steps: Expand Data Validation Requirements
Now that you've learned about some additional validation types let's expand the data validation requirements for creating new user accounts by requiring a password.
In your POST /api/users route request handler, add an if statement that checks for a missing password value:
router.post('/users', (req, res) => {
...
// Validate that we have a `name` value.
if (!user.name) { ... }
...