File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed 
start/hello-world/src/main/java/com/example/helloworld/controller Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change 1818import  java .util .stream .Collectors ;
1919
2020@ RestController 
21- @ RequestMapping (value  = "/api" , method  =  RequestMethod . POST )
21+ @ RequestMapping (value  = "/api" )
2222public  class  BookController  {
2323
2424 private  List <Book > books  = new  ArrayList <>();
@@ -36,8 +36,13 @@ public ResponseEntity deleteBookById(@PathVariable("id") int id) {
3636 }
3737
3838 @ GetMapping ("/book" )
39-  public  ResponseEntity  getBookByName (@ RequestParam ("name" ) String  name ) {
39+  public  ResponseEntity  getBookByName (@ RequestParam (value  =  "name" ) String  name ) {
4040 List <Book > results  = books .stream ().filter (book  -> book .getName ().equals (name )).collect (Collectors .toList ());
4141 return  ResponseEntity .ok (results );
4242 }
43+ 
44+  @ GetMapping ("/books" )
45+  public  ResponseEntity  getAllBook () {
46+  return  ResponseEntity .ok (books );
47+  }
4348}
                         You can’t perform that action at this time. 
           
                  
0 commit comments