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 Authentication with Express!

Instruction

Handle Failed User Authentication

To finish the authenticateUser() middleware function, let's add else statements to our if statements so that we can handle each of our expected failure cases. Inside the each statements, we'll set a value on a message variable that describes the failure that occurred, then check at the bottom of the function if the message variable has a value. At the top of the authenticateUser function, us...