Skip to content

Commit

Permalink
Merge branch 'patch-1' of https://github.com/TraLeeee/docs.nestjs.com
Browse files Browse the repository at this point in the history
…into TraLeeee-patch-1
  • Loading branch information
kamilmysliwiec committed Oct 17, 2024
2 parents a89b34c + 1f12632 commit c13efa7
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions content/techniques/mvc.md
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,17 @@ export class AppController {
}
}
```
Alternatively, you can inject the `@Res()` decorator and response which view you want as follows:

```typescript
import { Res } from '@nestjs/common';
import { FastifyReply } from 'fastify';

@Get()
root(@Res() res: FastifyReply) {
return res.view('index.hbs', { title: 'Hello world!' });
}
```

While the application is running, open your browser and navigate to `http://localhost:3000`. You should see the `Hello world!` message.

Expand Down

0 comments on commit c13efa7

Please sign in to comment.