Nuxt/docs/content/3.server/2.middleware.md

394 B

Server Middleware

Nuxt will automatically read in any files in the ~/server/middleware to create server middleware for your project. (These files will be run on every request, unliked API routes that are mapped to their own routes.)

Each file should export a default function that will handle a request.

export default async (req, res) => {
  req.someValue = true
}