Nuxt/docs/content/3.server/2.middleware.md
Daniel Roe 9164179b50
docs: server (#187)
Co-authored-by: Pooya Parsa <pyapar@gmail.com>
2021-06-08 23:57:15 +02:00

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
}