Course lesson

Add a Middleware to a Next.js API Route

In this lesson, you're going to learn how to create a Middleware that checks for the existence of an Authentication header. If that header doesn't exist, we'll terminate the request and let it continue if it does. We'll abstract that functionality in a...

Duration
3 min
Access
Included
Transcript
Retained from source evidence

In this lesson, you're going to learn how to create a Middleware that checks for the existence of an Authentication header. If that header doesn't exist, we'll terminate the request and let it continue if it does. We'll abstract that functionality in a middleware so we can reuse it in other API routes.