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

12 lines
394 B
Markdown
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 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](./api) that are mapped to their own routes.)
Each file should export a default function that will handle a request.
```js
export default async (req, res) => {
req.someValue = true
}
```