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

12 lines
394 B
Markdown
Raw Normal View History

2021-04-20 12:16:09 +00:00
# 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
}
```