-
-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: deprecate assigning function to schema in favor of `api-party:e…
…xtend` hook (#88) * feat: deprecate assigning function to schema in favor of hooks * refactor: use `api-party:extend` hook * docs: update --------- Co-authored-by: Johann Schopplich <[email protected]>
- Loading branch information
1 parent
da9a2bb
commit 4a6af04
Showing
6 changed files
with
60 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# Hooks | ||
|
||
Nuxt API Party provides a number of hooks that can be used to customize the module's behavior. Hooks are functions that are called at specific points in the module's lifecycle. You can use hooks to modify the module's configuration. | ||
|
||
For more information on how to work with hooks, see the [Nuxt documentation](https://nuxt.com/docs/guide/going-further/hooks). | ||
|
||
## Available Hooks | ||
|
||
| Hook name | Arguments | Description | | ||
| ---------- | --------- | ----------- | | ||
| `api-party:extend` | `options` | Called during module initialization after the options have been resolved. Can be used to modify the endpoint configuration. | | ||
|
||
## Usage | ||
|
||
To use hooks, define them in the `hooks` property of your `nuxt.config.ts` file. The following example demonstrates how to use the `api-party:extend` hook: | ||
|
||
```ts | ||
// `nuxt.config.ts` | ||
export default defineNuxtConfig({ | ||
modules: ['nuxt-api-party'], | ||
|
||
hooks: { | ||
'api-party:extend': async (options) => { | ||
console.log(`Resolved server endpoints:`, options.endpoints) | ||
}, | ||
}, | ||
}) | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters