We will now add the method to retrieve details for a specific Todo:
@GetMapping(path = "/users/{name}/todos/{id}")
public Todo retrieveTodo(@PathVariable String name, @PathVariable
int id) {
return todoService.retrieveTodo(id);
}
A couple of things to note are as follows:
- The URI mapped is /users/{name}/todos/{id}
- We have two path variables defined for name and id