diff --git a/docs/3.api/5.kit/11.nitro.md b/docs/3.api/5.kit/11.nitro.md index 641bf9cfe8..0a78203e13 100644 --- a/docs/3.api/5.kit/11.nitro.md +++ b/docs/3.api/5.kit/11.nitro.md @@ -105,14 +105,11 @@ Adds a nitro server handler to be used only in development mode. This handler wi ### Type ```ts -function addDevServerHandler (handler: NitroEventHandler): void +function addDevServerHandler (handler: NitroDevEventHandler): void -export interface NitroEventHandler { - handler: string; +export interface NitroDevEventHandler { + handler: EventHandler; route?: string; - middleware?: boolean; - lazy?: boolean; - method?: string; } ``` @@ -130,7 +127,7 @@ A handler object with the following properties: **Type**: `string` - Path to event handler. + The event handler. - `route` (optional) @@ -138,24 +135,6 @@ A handler object with the following properties: Path prefix or route. If an empty string used, will be used as a middleware. -- `middleware` (optional) - - **Type**: `boolean` - - Specifies this is a middleware handler. Middleware are called on every route and should normally return nothing to pass to the next handlers. - -- `lazy` (optional) - - **Type**: `boolean` - - Use lazy loading to import handler. - -- `method` (optional) - - **Type**: `string` - - Router method matcher. - ### Examples ::code-group @@ -168,21 +147,17 @@ export default defineNuxtModule({ const resolver = createResolver(import.meta.url) addDevServerHandler({ - handler: resolver.resolve('./runtime/uptime.get'), + handler: () => { + return { + body: `Response generated at ${new Date().toISOString()}` + } + }, route: '/_handler' }) } }) ``` -```ts [runtime/timer.get.ts] -export default defineEventHandler(() => { - return { - body: `Response generated at ${new Date().toISOString()}` - } -}) -``` - :: ```ts