September 2019
Intermediate to advanced
462 pages
11h 3m
English
It’s time to modify the TaskController we wrote earlier, to add two new methods and to modify the existing tasks() method—that is, the GET operation.
Once again, if we were to write in Java, here’s what the modified controller would look like:
| | //Java code only for comparison purpose |
| | package com.agiledeveloper.todo; |
| | |
| | import org.springframework.stereotype.Controller; |
| | import org.springframework.web.bind.annotation.*; |
| | import org.springframework.http.ResponseEntity; |
| | |
| | @RestController |
| | @RequestMapping("/task") |
| | class TaskController { |
| | |
| | private final TaskService service; |
| | |
| | public TaskController(TaskService service) { |
| | this.service = service; |
| | } |
| | |
| | @GetMapping |
| | ResponseEntity<Iterable<Task>> ... |
Read now
Unlock full access