@nuxt/docs-nightly 5.0.0-29814513.7591cbf1 → 5.0.0-29814633.9264b594
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/4.api/5.kit/12.nitro.md +11 -8
- package/package.json +1 -1
package/4.api/5.kit/12.nitro.md
CHANGED
|
@@ -34,7 +34,7 @@ export default defineNuxtModule({
|
|
|
34
34
|
### Type
|
|
35
35
|
|
|
36
36
|
```ts
|
|
37
|
-
function addServerHandler (handler:
|
|
37
|
+
function addServerHandler (handler: ServerHandlerInput): void
|
|
38
38
|
```
|
|
39
39
|
|
|
40
40
|
### Parameters
|
|
@@ -43,12 +43,18 @@ function addServerHandler (handler: NitroEventHandler): void
|
|
|
43
43
|
|
|
44
44
|
| Property | Type | Required | Description |
|
|
45
45
|
|--------------|-----------|----------|-----------------------------------------------------------------------------------------------------------------------------------------------|
|
|
46
|
-
| `handler` | `string` | `true` | Path to event handler.
|
|
47
|
-
| `route` | `string` | `false` |
|
|
46
|
+
| `handler` | `string \| { nuxt?: string, nitro2?: string, nitro3?: string }` | `true` | Path to the event handler, or one path per server API. Nuxt registers the implementation the application's server can run. |
|
|
47
|
+
| `route` | `string` | `false` | The route to match, exactly. End it in `/**` to match the paths below it as well. If an empty string is used, the handler is registered as middleware. |
|
|
48
48
|
| `middleware` | `boolean` | `false` | Specifies this is a middleware handler. Middleware are called on every route and should normally return nothing to pass to the next handlers. |
|
|
49
49
|
| `lazy` | `boolean` | `false` | Use lazy loading to import the handler. This is useful when you only want to load the handler on demand. |
|
|
50
50
|
| `method` | `string` | `false` | Router method matcher. If handler name contains method name, it will be used as a default value. |
|
|
51
51
|
|
|
52
|
+
A route ending in `/**` matches its base path too, so `route: '/_fonts/**'` serves `/_fonts` and everything below it. On a Nitro 2 host, whose router matches only the paths below the base, Nuxt registers the base path as a second route so that one registration behaves the same on both.
|
|
53
|
+
|
|
54
|
+
::read-more{to="/docs/4.x/guide/modules/server-compatibility"}
|
|
55
|
+
Learn when to register one path per server API, and which key to write your handler against.
|
|
56
|
+
::
|
|
57
|
+
|
|
52
58
|
### Example
|
|
53
59
|
|
|
54
60
|
#### Basic Usage
|
|
@@ -117,11 +123,8 @@ export default defineNuxtModule({
|
|
|
117
123
|
|
|
118
124
|
### Type
|
|
119
125
|
|
|
120
|
-
```ts
|
|
121
|
-
|
|
122
|
-
import type { NitroDevEventHandler } from 'nitro/types'
|
|
123
|
-
// ---cut---
|
|
124
|
-
function addDevServerHandler (handler: NitroDevEventHandler): void
|
|
126
|
+
```ts
|
|
127
|
+
function addDevServerHandler (handler: DevServerHandlerInput): void
|
|
125
128
|
```
|
|
126
129
|
|
|
127
130
|
### Parameters
|