mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-11 08:33:53 +00:00
docs(server): add example for early spiking middleware (#3564)
This commit is contained in:
parent
20f31712c1
commit
a55c7874e6
@ -89,4 +89,17 @@ export default async (req: IncomingMessage, res: ServerResponse) => {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
To pass the request deeper into the application, you can simply `return` inside the function:
|
||||||
|
|
||||||
|
```js
|
||||||
|
export default async (req, res) => {
|
||||||
|
const isNotHandledByThisMiddleware = req.url.includes('/some-unhandled-url-path/')
|
||||||
|
if(isNotHandledByThisMiddleware) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// Actual logic here
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
More information about custom middleware can be found in the documentation for [nuxt.config.js](/docs/directory-structure/nuxt.config#servermiddleware)
|
More information about custom middleware can be found in the documentation for [nuxt.config.js](/docs/directory-structure/nuxt.config#servermiddleware)
|
||||||
|
Loading…
Reference in New Issue
Block a user