|
@@ -22,7 +22,7 @@ public class MuffinController {
|
22
|
22
|
return new ResponseEntity<>(this.muffinRepository.findAll(), HttpStatus.OK);
|
23
|
23
|
}
|
24
|
24
|
|
25
|
|
- @RequestMapping(value="/muffins/id", method= RequestMethod.GET)
|
|
25
|
+ @RequestMapping(value="/muffins/{id}", method= RequestMethod.GET)
|
26
|
26
|
public ResponseEntity<Muffin> show(@PathVariable Long id) {
|
27
|
27
|
return new ResponseEntity<>(this.muffinRepository.findById(id).get(), HttpStatus.OK);
|
28
|
28
|
}
|
|
@@ -32,7 +32,7 @@ public class MuffinController {
|
32
|
32
|
return new ResponseEntity<>(this.muffinRepository.save(muffin), HttpStatus.CREATED);
|
33
|
33
|
}
|
34
|
34
|
|
35
|
|
- @RequestMapping(value="/muffins/id", method= RequestMethod.PUT)
|
|
35
|
+ @RequestMapping(value="/muffins/{id}", method= RequestMethod.PUT)
|
36
|
36
|
public ResponseEntity<Muffin> update(@PathVariable Long id, @RequestBody Muffin muffin) {
|
37
|
37
|
Muffin foundMuffin = muffinRepository.findById(id).get();
|
38
|
38
|
foundMuffin.setFlavor(muffin.getFlavor());
|
|
@@ -40,7 +40,7 @@ public class MuffinController {
|
40
|
40
|
return new ResponseEntity<>(this.muffinRepository.save(foundMuffin), HttpStatus.OK);
|
41
|
41
|
}
|
42
|
42
|
|
43
|
|
- @RequestMapping(value="/muffins/id", method= RequestMethod.DELETE)
|
|
43
|
+ @RequestMapping(value="/muffins/{id}", method= RequestMethod.DELETE)
|
44
|
44
|
public ResponseEntity<Boolean> destroy(@PathVariable Long id) {
|
45
|
45
|
this.muffinRepository.deleteById(id);
|
46
|
46
|
return new ResponseEntity<>(true, HttpStatus.OK);
|