Skip to content

Commit

Permalink
Merge pull request nestjs#2790 from rich-w-lee/docs/fastify-route-config
Browse files Browse the repository at this point in the history
docs(fastify): fastify route config docs
  • Loading branch information
kamilmysliwiec authored Aug 21, 2023
2 parents f91e38a + 1f838d4 commit a990bfc
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions content/techniques/performance.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,20 @@ export class LoggerMiddleware {
}
```

#### Route Config

You can use the [route config](https://fastify.dev/docs/latest/Reference/Routes/#config) feature of Fastify with the `@RouteConfig()` decorator.

```typescript
@RouteConfig({ output: 'hello world' })
@Get()
index(@Req() req) {
return req.routeConfig.output;
}
```

> info **Hint** `@RouteConfig()` is imported from `@nestjs/platform-fastify`.
#### Example

A working example is available [here](https://github.com/nestjs/nest/tree/master/sample/10-fastify).

0 comments on commit a990bfc

Please sign in to comment.