|
@@ -1,23 +1,34 @@
|
1
|
1
|
package io.zipcoder.crudapp;
|
2
|
2
|
|
3
|
|
-import org.springframework.web.bind.annotation.GetMapping;
|
4
|
|
-import org.springframework.web.bind.annotation.RequestMapping;
|
5
|
|
-import org.springframework.web.bind.annotation.RestController;
|
|
3
|
+import org.springframework.web.bind.annotation.*;
|
6
|
4
|
|
7
|
5
|
import java.util.List;
|
8
|
6
|
|
9
|
7
|
@RestController
|
10
|
8
|
public class PersonController {
|
11
|
9
|
|
12
|
|
- @RequestMapping()
|
13
|
|
- public Person createPerson(Person p){}
|
|
10
|
+ @RequestMapping(value = "/people", method = RequestMethod.POST)
|
|
11
|
+ public Person createPerson(Person p){
|
|
12
|
+ return p;
|
|
13
|
+ }
|
14
|
14
|
|
15
|
|
- public Person getPerson(int id){}
|
16
|
15
|
|
17
|
|
- public List<Person> getPersonList(){}
|
|
16
|
+ @RequestMapping(value = "/people/{id}", method = RequestMethod.GET)
|
|
17
|
+ public Person getPerson(@PathVariable("id")int id){
|
|
18
|
+ return null;
|
|
19
|
+ }
|
18
|
20
|
|
19
|
|
- public Person updatePerson(){}
|
|
21
|
+ @RequestMapping(value = "/people",method = RequestMethod.GET)
|
|
22
|
+ public List<Person> getPersonList(){
|
|
23
|
+ return null;
|
|
24
|
+ }
|
20
|
25
|
|
21
|
|
- public void deletePerson(int id){}
|
|
26
|
+ @RequestMapping(value = "/people/{id}", method = RequestMethod.PUT)
|
|
27
|
+ public Person updatePerson(Person p){
|
|
28
|
+ return p;
|
|
29
|
+ }
|
|
30
|
+
|
|
31
|
+ @RequestMapping(value = "/people/{id}", method = RequestMethod.DELETE)
|
|
32
|
+ public void deletePerson(@PathVariable("id")int id){}
|
22
|
33
|
|
23
|
34
|
}
|