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!
You have completed REST API Authentication with Express!
Instruction
Set up the Authentication Middleware
Now that the app has a way to create new users, you can turn your attention to user authentication.
One approach would be to update each REST API route that needs to be protected (requires authentication) with the code to implement Basic Authentication. However, that approach would add a lot of duplicate code to your Express request handlers.
A better option is to create a custom middleware f...