mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-25 23:22:02 +00:00
docs(guide): add nitro plugins to server directory (#7780)
This commit is contained in:
parent
51ff394f23
commit
555b43095d
@ -66,6 +66,21 @@ export default defineEventHandler((event) => {
|
|||||||
})
|
})
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Server Plugins
|
||||||
|
|
||||||
|
Nuxt will automatically read any files in the `~/server/plugins` directory and register them as Nitro plugins. This allows extending Nitro's runtime behavior and hooking into lifecycle events.
|
||||||
|
|
||||||
|
**Example:**
|
||||||
|
|
||||||
|
```ts [server/plugins/nitroPlugin.ts]
|
||||||
|
export default defineNitroPlugin((nitroApp) => {
|
||||||
|
console.log('Nitro plugin', nitroApp)
|
||||||
|
})
|
||||||
|
```
|
||||||
|
|
||||||
|
::ReadMore{link="https://nitro.unjs.io/guide/advanced/plugins" title="Nitro Plugins"}
|
||||||
|
::
|
||||||
|
|
||||||
## Server Utilities
|
## Server Utilities
|
||||||
|
|
||||||
Server routes are powered by [unjs/h3](https://github.com/unjs/h3) which comes with a handy set of helpers.
|
Server routes are powered by [unjs/h3](https://github.com/unjs/h3) which comes with a handy set of helpers.
|
||||||
|
Loading…
Reference in New Issue
Block a user