|
|
@@ -5,6 +5,8 @@ import io.zipcoder.persistenceapp.service.PersonService;
|
|
5
|
5
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
6
|
6
|
import org.springframework.http.HttpStatus;
|
|
7
|
7
|
import org.springframework.http.ResponseEntity;
|
|
|
8
|
+
|
|
|
9
|
+import org.springframework.web.bind.annotation.PathVariable;
|
|
8
|
10
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
9
|
11
|
import org.springframework.web.bind.annotation.RequestMethod;
|
|
10
|
12
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
@@ -19,4 +21,11 @@ public class PersonController {
|
|
19
|
21
|
Iterable<Person> people = personService.getAllPeople();
|
|
20
|
22
|
return new ResponseEntity<>(people, HttpStatus.OK);
|
|
21
|
23
|
}
|
|
|
24
|
+
|
|
|
25
|
+ @RequestMapping(value = "/person/{id}", method = RequestMethod.GET)
|
|
|
26
|
+ public ResponseEntity<Person> getPersonById(@PathVariable Integer id) {
|
|
|
27
|
+ Person p = personService.findPersonById(id);
|
|
|
28
|
+ return new ResponseEntity<>(p, HttpStatus.OK);
|
|
|
29
|
+ }
|
|
|
30
|
+
|
|
22
|
31
|
}
|