NestJS · Junior · Question 16 of 75

Which route does this handler serve?

@Controller("users")
export class UsersController {
  @Get(":id")
  findOne(@Param("id") id: string) {}
}

Explanation

The controller prefix and the method path are joined. With app.setGlobalPrefix('api') it becomes /api/users/:id.

Further reading

Problem with a question

NestJS · Junior · question 16

Test yourself

Take the NestJS · Junior quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz