Skip to content

Commit

Permalink
docs: how to use with @fastify/autoload (#789)
Browse files Browse the repository at this point in the history
  • Loading branch information
bijela-gora authored Mar 18, 2024
1 parent 352f7d6 commit 0ac8d85
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,23 @@ fastify.put('/some-route/:id', {
await fastify.ready()
fastify.swagger()
```

<a name="usage.fastify.autoload"></a>
### With `@fastify/autoload`

You need to register `@fastify/swagger` before registering `@fastify/autoload`.

```js
const fastify = require('fastify')()
const fastify = fastify()
await fastify.register(require('@fastify/swagger'))
fastify.register(require("@fastify/autoload"), {
dir: path.join(__dirname, 'routes')
})
await fastify.ready()
fastify.swagger()
```

<a name="api"></a>
## API

Expand Down

0 comments on commit 0ac8d85

Please sign in to comment.