Skip to content

Commit 93cf01d

Browse files
committed
Merge branch 'phikes-add-example-for-req-res-usage' into next
2 parents 8395465 + 53340bc commit 93cf01d

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

README.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,10 +262,19 @@ import {Controller, Req, Res, Get} from "routing-controllers";
262262
export class UserController {
263263
264264
@Get("/users")
265-
getAll(@Req() request: any, @Res() response: any) {
265+
getAllUsers(@Req() request: any, @Res() response: any) {
266266
return response.send("Hello response!");
267267
}
268268
269+
@Get("/posts")
270+
getAllPosts(@Req() request: any, @Res() response: any) {
271+
// some response functions don't return the response object,
272+
// so it needs to be returned explicitly
273+
response.redirect("/users");
274+
275+
return response;
276+
}
277+
269278
}
270279
```
271280

0 commit comments

Comments
 (0)