Guided example · illustrative source

Example / fulfillment-api

2 controller files inspected · 2 declared endpoints

Compare response conventions

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?

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:8

Injected response

The 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:9

Maintainer review

Leave the handoff

Your choices stay in this tab until you download the Markdown file. Keep it in the repo for your team.