...

/

Server Middleware

Server Middleware

Learn how to add middleware to our server routes.

On the front end of our project, we could run code that we may want to execute before navigating to a particular route. This was an additional step between navigation, used to perform a task such as checking if a user is allowed access to a page.

Server middleware

We can also add middleware to our server routes. These middleware files are added to a ~/server/middleware directory, and Nuxt will automatically read any files we add. ...