Skip to content

Commit

Permalink
docs: document new option type
Browse files Browse the repository at this point in the history
  • Loading branch information
jean-michelet committed Jun 11, 2024
1 parent 97c81fa commit 852bc73
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ FASTIFY_AUTOLOAD_TYPESCRIPT=1 node --loader=my-custom-loader index.ts
Each plugin can be individually configured using the following module properties:
- `plugin.autoConfig` - Configuration object which will be used as `opts` parameter
- `plugin.autoConfig` - Specifies the options to be used as the `opts` parameter.
```js
module.exports = function (fastify, opts, next) {
Expand All @@ -332,6 +332,13 @@ Each plugin can be individually configured using the following module properties
export const autoConfig = { name: 'y' }
```
You can also use a callback function if you need to access the parent instance:
```js
export const autoConfig = (fastify) => {
return { name: 'y ' + fastify.rootName }
}
```
- `plugin.autoPrefix` - Set routing prefix for plugin
```js
Expand Down

0 comments on commit 852bc73

Please sign in to comment.