Skip to content
This repository has been archived by the owner on Apr 6, 2023. It is now read-only.

Commit

Permalink
docs(guide): add nitro plugins to server directory (#7780)
Browse files Browse the repository at this point in the history
  • Loading branch information
huang-julien committed Sep 26, 2022
1 parent 51ff394 commit 555b430
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions docs/content/2.guide/2.directory-structure/1.server.md
Expand Up @@ -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 routes are powered by [unjs/h3](https://github.com/unjs/h3) which comes with a handy set of helpers.
Expand Down

0 comments on commit 555b430

Please sign in to comment.