Skip to content

Commit c13efa7

Browse files
Merge branch 'patch-1' of https://github.com/TraLeeee/docs.nestjs.com into TraLeeee-patch-1
2 parents a89b34c + 1f12632 commit c13efa7

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

content/techniques/mvc.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,17 @@ export class AppController {
197197
}
198198
}
199199
```
200+
Alternatively, you can inject the `@Res()` decorator and response which view you want as follows:
201+
202+
```typescript
203+
import { Res } from '@nestjs/common';
204+
import { FastifyReply } from 'fastify';
205+
206+
@Get()
207+
root(@Res() res: FastifyReply) {
208+
return res.view('index.hbs', { title: 'Hello world!' });
209+
}
210+
```
200211

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

0 commit comments

Comments
 (0)