Standard handler
The signature uses no Nest response parameter. Nest normally handles the returned value.
GET /orders/:id @Get(":id")
find(@Param("id") id: string) {
return this.orders.find(id);
}src/orders/orders.controller.ts:8Guided example · illustrative source
2 controller files inspected · 2 declared endpoints
Both endpoints look up one record. Orders returns a value for Nest to serialize. Returns sets the status and sends JSON itself. Which should the next developer copy?
The signature uses no Nest response parameter. Nest normally handles the returned value.
GET /orders/:id @Get(":id")
find(@Param("id") id: string) {
return this.orders.find(id);
}src/orders/orders.controller.ts:8The signature requests the response object. Inspect how the handler finishes the request.
GET /returns/:id @Get(":id")
async find(@Param("id") id: string, @Res() res: Response) {
const item = await this.returns.find(id);
res.status(200).json(item);
}src/returns/returns.controller.ts:9Maintainer review
Your choices stay in this tab until you download the Markdown file. Keep it in the repo for your team.