1×
Become a member
to unlock all features

Level Up!

Access all courses & lessons on egghead today and lock-in your price for life.

Autoplay

    Create Custom Middleware for Authentication in Express

    expressExpress

    Express provides a straightforward workflow to add functionality between the request and the response.

    In this space your application can check the request, query other APIs and build up the response in parts before sending the final response.

    In this lesson, we'll add an authenication middleware that will check for a specific header and confirm that it has the correct value. If either of these tests fail then the middleware will send an early response with a 401 status.